Re: [Boost-bugs] [Boost C++ Libraries] #5282: Test fixtures do not support virtual inheritance

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5282: Test fixtures do not support virtual inheritance
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-11-09 22:04:28


#5282: Test fixtures do not support virtual inheritance
--------------------------------------+-------------------------------------
  Reporter: tye.zdrojewski@… | Owner: rogeeff
      Type: Feature Requests | Status: new
 Milestone: To Be Determined | Component: test
   Version: Boost 1.45.0 | Severity: Problem
Resolution: | Keywords:
--------------------------------------+-------------------------------------

Comment (by Tye Z. <tye.zdrojewski@…>):

 Ok, so if I have a class {{{TestMe}}}...


 {{{
 class TestMe
 {
 protected:
    bool protectedValue = 0;
    int protectedMethod(int arg) { ... }
    void someProtectedBehavior() { ... }
 }
 }}}
 I will usually create a fixture as a subclass:
 {{{
 /**
  * Override methods to add test functionality
  */
 class TestMeFixture : public TestMe
 {
    // override production behavior for testing
    void someProtectedBehavior() { ... }
 }

 BOOST_FIXTURE_TEST_SUITE( MyTestSuite, TestMeFixture )
 BOOST_AUTO_TEST_CASE( test_top_level_values )
 {
    int expected = 123;
    BOOST_CHECK_EQUAL(expected, protectedMethod(456)); // call protected
 method
    BOOST_CHECK(protectedValue); // get protected value
    ...
 }
 BOOST_AUTO_TEST_SUITE_END()
 }}}
 ...which is far more concise than writing a subclass as separate from the
 fixture, which would force you to write all sorts of getters and setters
 and wrappers for protected members.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5282#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC