Returning NULL from createSuite leads to test failure
rkennedy opened this issue · 0 comments
rkennedy commented
Under "dynamically created test suites," the documentation demonstrates providing a createSuite
method and conditionally returning NULL
, but the behavior isn't what I expected.
Here's my test case:
#include <cxxtest/TestSuite.h>
class Foo: public CxxTest::TestSuite
{
public:
static Foo* createSuite() {
return 0;
}
static void destroySuite(Foo* suite) {
delete suite;
}
void test_foo() {
return;
}
};
I process it with these commands:
cxxtest-4.4/bin/cxxtestgen --have-std --have-eh --error-printer -o foo_test.cpp foo.h
g++ -Wall -o foo_test foo_test.cpp
I get the following output:
Running cxxtest tests (1 test)
In Foo::<no test>:
foo.h:6: Error: Test failed: createSuite() failed
foo.h:6: Error: Assertion failed: suite() != 0
Failed 1 and Skipped 0 of 1 test
Success rate: 0%
Is this really the intended behavior? If so, then the documentation should mention this and include a more compelling example. (The current example checks the compiler, but if I wanted the test to fail when used with the wrong compiler, I'd just make the whole compilation fail, and it would have nothing to do with createSuite
.)
I expected the suite and its tests to be marked as skipped.