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,
'BOOST_GLOBAL_FIXTURE( fixture )'

The example that is provided with Boost demonstrates setup and teardown
utilizing the constructor and destructor of the fixture passed through the
macro.
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_GLOBAL_FIXTURE( Fixture )

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 hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net