Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrectly parsing of derived class #1

Open
kindkaktus opened this issue Jun 12, 2014 · 0 comments
Open

Incorrectly parsing of derived class #1

kindkaktus opened this issue Jun 12, 2014 · 0 comments

Comments

@kindkaktus
Copy link

cxxtest has difficulties parsing derived classes. Consider the following code:

#include "cxxtest/TestSuite.h"

class MyTestBase : public CxxTest::TestSuite 
{};

class MyTest : public MyTestBase
{
public:
    void test1()
    {}
};

class MyTest2 : public MyTestBase
{
public:
    void test2()
    {}
};

After calling
python-2.7\python cxxtest\bin\cxxtestgen --have-eh --have-std --part -o mytest.cpp MyTest.h

The generated mytest.cpp erroneously creates test1() test case for MyTest2 suite, which obviously results in compilation error "error C2039: 'test1' : is not a member of 'MyTest2'" later on. Below is a generated mytest.cpp

include "MyTest.h"

static MyTest suite_MyTest;

static CxxTest::List Tests_MyTest = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_MyTest( "MyTest.h", 10, "MyTest", suite_MyTest, Tests_MyTest );

static class TestDescription_suite_MyTest_test1 : public CxxTest::RealTestDescription {
public:
 TestDescription_suite_MyTest_test1() : CxxTest::RealTestDescription( Tests_MyTest, suiteDescription_MyTest, 13, "test1" ) {}
 void runTest() { suite_MyTest.test1(); }
} testDescription_suite_MyTest_test1;

static MyTest2 suite_MyTest2;

static CxxTest::List Tests_MyTest2 = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_MyTest2( "MyTest.h", 18, "MyTest2", suite_MyTest2, Tests_MyTest2 );

static class TestDescription_suite_MyTest2_test1 : public CxxTest::RealTestDescription {
public:
 TestDescription_suite_MyTest2_test1() : CxxTest::RealTestDescription( Tests_MyTest2, suiteDescription_MyTest2, 13, "test1" ) {}
 void runTest() { suite_MyTest2.test1(); }
} testDescription_suite_MyTest2_test1;

static class TestDescription_suite_MyTest2_test2 : public CxxTest::RealTestDescription {
public:
 TestDescription_suite_MyTest2_test2() : CxxTest::RealTestDescription( Tests_MyTest2, suiteDescription_MyTest2, 21, "test2" ) {}
 void runTest() { suite_MyTest2.test2(); }
} testDescription_suite_MyTest2_test2;

Renaming MyTest to MyNewTest makes the problem go.

What I found remarkable for the same version of Python (2.7.3) the issue shows up on Windows only, not on Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant