diff options
author | jmmv <jmmv@FreeBSD.org> | 2014-02-14 19:33:16 +0000 |
---|---|---|
committer | jmmv <jmmv@FreeBSD.org> | 2014-02-14 19:33:16 +0000 |
commit | 3000aef4b44bdeb9b83e0df3facbc6a75f8da412 (patch) | |
tree | 12192b0e3ae6cc3f8047467370fbd632a6788123 /contrib/atf/atf-c++/macros_test.cpp | |
parent | e21b440a4ce43fd31d59cd278801c727e21d3f2b (diff) | |
parent | 14f39fed9fe557bdd640e02d9abbe2e695400d9e (diff) | |
download | FreeBSD-src-3000aef4b44bdeb9b83e0df3facbc6a75f8da412.zip FreeBSD-src-3000aef4b44bdeb9b83e0df3facbc6a75f8da412.tar.gz |
MFV: Import atf-0.20.
Diffstat (limited to 'contrib/atf/atf-c++/macros_test.cpp')
-rw-r--r-- | contrib/atf/atf-c++/macros_test.cpp | 29 |
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. |