Boost logo

Boost Users :

Subject: [Boost-users] [boost] [Test] [1.35] How would one access a global fixture's member?
From: Stephen Watjen (swatjen_at_[hidden])
Date: 2009-05-13 17:22:11

I came across an example of a global fixture macro in the docs,

The example that is provided with Boost demonstrates setup and teardown
utilizing the constructor and destructor of the fixture passed through the
It does not show members in this global fixture.

I added a member to the fixture and tried to access it within a test case
and I received a compiler error stating that the variable had not been
declared in this scope.

Is it possible to access a global fixture member?  If yes, then how?

struct Fixture
  const char* str;


BOOST_TEST_CASE( testGlobalFixture )
    BOOST_CHECK( str != 0 );

// The above code fails to compile stating: 'str' undeclared (first use
this function)

Steve Watjen

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at