From d3e24a31ef4ec197446e1a41e07a41bab387a71e Mon Sep 17 00:00:00 2001 From: srz_zumix Date: Thu, 15 Dec 2022 00:49:43 +0900 Subject: [PATCH 1/6] update scoped_trace_exception_tests --- projects/vscode/iutest.code-workspace | 24 +++++++++++++++++++++++- test/scoped_trace_exception_tests.cpp | 13 ++++--------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/projects/vscode/iutest.code-workspace b/projects/vscode/iutest.code-workspace index 152205975c..ce9247110b 100644 --- a/projects/vscode/iutest.code-workspace +++ b/projects/vscode/iutest.code-workspace @@ -136,7 +136,29 @@ "version": "cpp", "*.defs": "cpp" }, - "bracketLens.minBracketScopeLines": 12 + "bracketLens.minBracketScopeLines": 12, + "editor.tokenColorCustomizations": { + "textMateRules": [ + { + "scope": "googletest.failed", + "settings": { + "foreground": "#f00" + } + }, + { + "scope": "googletest.passed", + "settings": { + "foreground": "#0f0" + } + }, + { + "scope": "googletest.run", + "settings": { + "foreground": "#0f0" + } + } + ] + } }, "launch": { "configurations": [ diff --git a/test/scoped_trace_exception_tests.cpp b/test/scoped_trace_exception_tests.cpp index 188ddc3a26..a0e5712718 100644 --- a/test/scoped_trace_exception_tests.cpp +++ b/test/scoped_trace_exception_tests.cpp @@ -30,8 +30,6 @@ # endif #endif -#if EXCEPTION_CATCH_TEST - bool no_throw = false; IUTEST(ScopedTraceExceptionTest, Exception) @@ -92,15 +90,12 @@ IUTEST_F(DISABLED_ScopedTraceExceptionSetUpTest, Empty) { } -#endif - #ifdef UNICODE int wmain(int argc, wchar_t* argv[]) #else int main(int argc, char* argv[]) #endif { -#if EXCEPTION_CATCH_TEST IUTEST_INIT(&argc, argv); ::iutest::IUTEST_FLAG(catch_exceptions) = true; #if defined(DISABLE_FALSE_POSITIVE_XML) @@ -130,6 +125,7 @@ int main(int argc, char* argv[]) if( ret == 0 ) return 1; } +#if EXCEPTION_CATCH_TEST IUTEST_ASSERT_STRIN( "ScopedTraceExceptionTest Scoped Exception A", logger.c_str()) << ::iutest::AssertionReturn(1); IUTEST_ASSERT_STRNOTIN("ScopedTraceExceptionTest Scoped Exception B", logger.c_str()) @@ -148,6 +144,7 @@ int main(int argc, char* argv[]) << ::iutest::AssertionReturn(1); IUTEST_ASSERT_STRNOTIN("ScopedTraceExceptionTest Scoped Assertion B", logger.c_str()) << ::iutest::AssertionReturn(1); +#endif no_throw = true; logger.clear(); @@ -156,6 +153,7 @@ int main(int argc, char* argv[]) if( ret != 0 ) return 1; } +#if EXCEPTION_CATCH_TEST IUTEST_ASSERT_STRNOTIN("ScopedTraceExceptionTest Scoped Exception A", logger.c_str()) << ::iutest::AssertionReturn(1); IUTEST_ASSERT_STRNOTIN("ScopedTraceExceptionTest Scoped Exception B", logger.c_str()) @@ -164,11 +162,8 @@ int main(int argc, char* argv[]) << ::iutest::AssertionReturn(1); IUTEST_ASSERT_STRNOTIN("ScopedTraceExceptionTest Scoped Exception D", logger.c_str()) << ::iutest::AssertionReturn(1); - -#else - IUTEST_UNUSED_VAR(argc); - IUTEST_UNUSED_VAR(argv); #endif + printf("*** Successful ***\n"); return 0; } From 29411b0a5d18a1615d8ba6268a0b60bac152221f Mon Sep 17 00:00:00 2001 From: srz_zumix Date: Thu, 15 Dec 2022 01:35:28 +0900 Subject: [PATCH 2/6] up --- projects/cmake/CMakeLists.txt | 4 ++-- test/CommonMakefile.in | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/cmake/CMakeLists.txt b/projects/cmake/CMakeLists.txt index 9f179df10e..39a193e8fe 100644 --- a/projects/cmake/CMakeLists.txt +++ b/projects/cmake/CMakeLists.txt @@ -256,6 +256,7 @@ if (build_tests) cxx_executable_test(random_seed_tests) cxx_executable_test(record_property_tests) cxx_executable_test(repeat_tests) + cxx_executable_test(scoped_trace_exception_tests) cxx_executable_test(scoped_trace_tests) cxx_executable_test(set_up_failure_tests) cxx_executable_test(set_up_global_failure_tests) @@ -320,7 +321,6 @@ if (build_tests) cxx_executable_test(param_test_name_invalid_tests) cxx_executable_test(param_test_name_tests) cxx_executable_test(no_yoda_tests) - cxx_executable_test(scoped_trace_exception_tests) cxx_executable_test(spec_tests) cxx_executable_test(tap_file_generator_listener_tests) cxx_executable_test(tap_printer_listener_tests) @@ -396,6 +396,7 @@ if (build_tests) cxx_add_test(random_seed_tests) cxx_add_test(record_property_tests) cxx_add_test(repeat_tests) + cxx_add_test(scoped_trace_exception_tests) cxx_add_test(scoped_trace_tests) cxx_add_test(set_up_failure_tests) cxx_add_test(set_up_global_failure_tests) @@ -436,7 +437,6 @@ if (build_tests) cxx_add_test(param_test_name_invalid_tests) cxx_add_test(param_test_name_tests) cxx_add_test(no_yoda_tests) - cxx_add_test(scoped_trace_exception_tests) cxx_add_test(spec_tests) cxx_add_test(tap_file_generator_listener_tests) cxx_add_test(tap_printer_listener_tests) diff --git a/test/CommonMakefile.in b/test/CommonMakefile.in index fb91c7a34d..b8a0d13b55 100644 --- a/test/CommonMakefile.in +++ b/test/CommonMakefile.in @@ -141,7 +141,8 @@ TEST_TARGETS= \ $(OUTDIR)/random_seed_tests \ $(OUTDIR)/record_property_tests \ $(OUTDIR)/repeat_tests \ - $(OUTDIR)/scoped_trace_tests \ + $(OUTDIR)/scoped_trace_exception_tests \ +z $(OUTDIR)/scoped_trace_tests \ $(OUTDIR)/set_up_failure_tests \ $(OUTDIR)/set_up_global_failure_tests \ $(OUTDIR)/set_up_testcase_failure_tests \ @@ -184,7 +185,6 @@ TARGETS_IUTEST_ONLY = \ $(OUTDIR)/param_test_name_invalid_tests \ $(OUTDIR)/param_test_name_tests \ $(OUTDIR)/no_yoda_tests \ - $(OUTDIR)/scoped_trace_exception_tests \ $(OUTDIR)/tap_file_generator_listener_tests \ $(OUTDIR)/tap_printer_listener_tests \ $(OUTDIR)/type_param_register_exception_int_tests \ From c109513d492d0f0a75c07922caec63fe10e4828f Mon Sep 17 00:00:00 2001 From: srz_zumix Date: Thu, 15 Dec 2022 01:50:11 +0900 Subject: [PATCH 3/6] fix --- test/CommonMakefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CommonMakefile.in b/test/CommonMakefile.in index b8a0d13b55..05d62c3a55 100644 --- a/test/CommonMakefile.in +++ b/test/CommonMakefile.in @@ -142,7 +142,7 @@ TEST_TARGETS= \ $(OUTDIR)/record_property_tests \ $(OUTDIR)/repeat_tests \ $(OUTDIR)/scoped_trace_exception_tests \ -z $(OUTDIR)/scoped_trace_tests \ + $(OUTDIR)/scoped_trace_tests \ $(OUTDIR)/set_up_failure_tests \ $(OUTDIR)/set_up_global_failure_tests \ $(OUTDIR)/set_up_testcase_failure_tests \ From b6b616508a319a4c471e35e7bffe1c4720bbb3df Mon Sep 17 00:00:00 2001 From: srz_zumix Date: Thu, 15 Dec 2022 01:58:27 +0900 Subject: [PATCH 4/6] fix --- test/scoped_trace_exception_tests.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/scoped_trace_exception_tests.cpp b/test/scoped_trace_exception_tests.cpp index a0e5712718..bb7a61c6eb 100644 --- a/test/scoped_trace_exception_tests.cpp +++ b/test/scoped_trace_exception_tests.cpp @@ -107,8 +107,10 @@ int main(int argc, char* argv[]) IUTEST_ASSERT_NE(IUTEST_RUN_ALL_TESTS(), 0) << ::iutest::AssertionReturn(1); +#if !defined(IUTEST_USE_GTEST) TestLogger logger; ::iutest::detail::iuConsole::SetLogger(&logger); +#endif try { @@ -147,7 +149,9 @@ int main(int argc, char* argv[]) #endif no_throw = true; +#if defined(IUTEST_USE_GTEST) logger.clear(); +#endif { const int ret = IUTEST_RUN_ALL_TESTS(); if( ret != 0 ) return 1; From db38be5c3c8eea34289c1a6202762d6a95d70ec4 Mon Sep 17 00:00:00 2001 From: srz_zumix Date: Thu, 15 Dec 2022 02:06:05 +0900 Subject: [PATCH 5/6] fix --- test/scoped_trace_exception_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/scoped_trace_exception_tests.cpp b/test/scoped_trace_exception_tests.cpp index bb7a61c6eb..a1c830b37c 100644 --- a/test/scoped_trace_exception_tests.cpp +++ b/test/scoped_trace_exception_tests.cpp @@ -149,7 +149,7 @@ int main(int argc, char* argv[]) #endif no_throw = true; -#if defined(IUTEST_USE_GTEST) +#if !defined(IUTEST_USE_GTEST) logger.clear(); #endif { From 66b22eb158b7fbb2fe73a1b4bf54d9635a89f279 Mon Sep 17 00:00:00 2001 From: srz_zumix Date: Thu, 15 Dec 2022 23:03:19 +0900 Subject: [PATCH 6/6] up --- test/scoped_trace_exception_tests.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/scoped_trace_exception_tests.cpp b/test/scoped_trace_exception_tests.cpp index a1c830b37c..00d5049b4f 100644 --- a/test/scoped_trace_exception_tests.cpp +++ b/test/scoped_trace_exception_tests.cpp @@ -18,6 +18,16 @@ #include "iutest.hpp" #include "logger_tests.hpp" +#if defined(IUTEST_USE_GTEST) +# if GTEST_VER <= 0x01080000 +# define SCOPED_TRACE_EXCEPTION_TEST 0 +# endif +#endif + +#if !defined(SCOPED_TRACE_EXCEPTION_TEST) +# define SCOPED_TRACE_EXCEPTION_TEST 1 +#endif + #if defined(IUTEST_USE_GTEST) # define EXCEPTION_CATCH_TEST 0 #endif @@ -96,6 +106,7 @@ int wmain(int argc, wchar_t* argv[]) int main(int argc, char* argv[]) #endif { +#if SCOPED_TRACE_EXCEPTION_TEST IUTEST_INIT(&argc, argv); ::iutest::IUTEST_FLAG(catch_exceptions) = true; #if defined(DISABLE_FALSE_POSITIVE_XML) @@ -168,6 +179,10 @@ int main(int argc, char* argv[]) << ::iutest::AssertionReturn(1); #endif +#else + IUTEST_UNUSED_VAR(argc); + IUTEST_UNUSED_VAR(argv); +#endif printf("*** Successful ***\n"); return 0; }