Opened 7 years ago

Closed 7 years ago

#11418 closed Bugs (invalid)

tests which do nothing should not return 0 as return value

Reported by: peters@… Owned by: Gennadiy Rozental
Milestone: To Be Determined Component: test
Version: Boost 1.57.0 Severity: Problem
Keywords: Cc:

Description

Given:

#define BOOST_TEST_MODULE This is my test

#define NDEBUG 
#include <boost/test/unit_test.hpp>

BOOST_AUTO_TEST_CASE( only_and_useless_testcase_in_file ) {
    BOOST_ASSERT(1 == 0);
}

running this test does nothing because BOOST_ASSERT evaluates to nothing. Which is ok, but the overall test should not return 0 in this case. We had several tests in our test suite that were effectively disabled by the NDEBUG but nobody detected it, because the the tests returned everything is ok (and nobody looked at the output, because everything was fine)

Change History (1)

comment:1 by Raffi Enficiaud, 7 years ago

Resolution: invalid
Status: newclosed

An empty test tree is considered as a failure. Inside a test case, there is no such constraint, and this is by design: your bug can be considered as a feature.

Note: See TracTickets for help on using tickets.