diff options
author | Julio Merino <jmmv@FreeBSD.org> | 2014-02-14 14:41:25 +0000 |
---|---|---|
committer | Julio Merino <jmmv@FreeBSD.org> | 2014-02-14 14:41:25 +0000 |
commit | 8fee91db34c6746951ced9a348b36c5b758d576e (patch) | |
tree | a986bed64ee725de3eb52c5f0838f6c59b8aa7d9 /atf-c++/macros_test.cpp | |
parent | bf351e294647b19b2abb7e59344e619866206e71 (diff) |
Notes
Diffstat (limited to 'atf-c++/macros_test.cpp')
-rw-r--r-- | atf-c++/macros_test.cpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/atf-c++/macros_test.cpp b/atf-c++/macros_test.cpp index 67e41061c8b0..4113ed0e61ce 100644 --- a/atf-c++/macros_test.cpp +++ b/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. |