summaryrefslogtreecommitdiffstats
path: root/contrib/atf/atf-c++/macros_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/atf/atf-c++/macros_test.cpp')
-rw-r--r--contrib/atf/atf-c++/macros_test.cpp29
1 files changed, 24 insertions, 5 deletions
diff --git a/contrib/atf/atf-c++/macros_test.cpp b/contrib/atf/atf-c++/macros_test.cpp
index 67e4106..4113ed0 100644
--- a/contrib/atf/atf-c++/macros_test.cpp
+++ b/contrib/atf/atf-c++/macros_test.cpp
@@ -763,11 +763,30 @@ BUILD_TC(use, "macros_hpp_test.cpp",
"do not cause syntax errors when used",
"Build of macros_hpp_test.cpp failed; some macros in "
"atf-c++/macros.hpp are broken");
-BUILD_TC_FAIL(detect_unused_tests, "unused_test.cpp",
- "Tests that defining an unused test case raises a warning (and thus "
- "an error)",
- "Build of unused_test.cpp passed; unused test cases are not properly "
- "detected");
+
+ATF_TEST_CASE(detect_unused_tests);
+ATF_TEST_CASE_HEAD(detect_unused_tests)
+{
+ set_md_var("descr",
+ "Tests that defining an unused test case raises a warning (and "
+ "thus an error)");
+}
+ATF_TEST_CASE_BODY(detect_unused_tests)
+{
+ const char* validate_compiler =
+ "class test_class { public: int dummy; };\n"
+ "#define define_unused static test_class unused\n"
+ "define_unused;\n";
+
+ atf::utils::create_file("compiler_test.cpp", validate_compiler);
+ if (build_check_cxx_o("compiler_test.cpp"))
+ expect_fail("Compiler does not raise a warning on an unused "
+ "static global variable declared by a macro");
+
+ if (build_check_cxx_o_srcdir(*this, "unused_test.cpp"))
+ ATF_FAIL("Build of unused_test.cpp passed; unused test cases are "
+ "not properly detected");
+}
// ------------------------------------------------------------------------
// Main.
OpenPOWER on IntegriCloud