Skip to content

Commit

Permalink
Merge b6b6165 into 56d7589
Browse files Browse the repository at this point in the history
  • Loading branch information
srz-zumix committed Dec 14, 2022
2 parents 56d7589 + b6b6165 commit 1ba4c8b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 13 deletions.
4 changes: 2 additions & 2 deletions projects/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
24 changes: 23 additions & 1 deletion projects/vscode/iutest.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
2 changes: 1 addition & 1 deletion test/CommonMakefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ TEST_TARGETS= \
$(OUTDIR)/random_seed_tests \
$(OUTDIR)/record_property_tests \
$(OUTDIR)/repeat_tests \
$(OUTDIR)/scoped_trace_exception_tests \
$(OUTDIR)/scoped_trace_tests \
$(OUTDIR)/set_up_failure_tests \
$(OUTDIR)/set_up_global_failure_tests \
Expand Down Expand Up @@ -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 \
Expand Down
17 changes: 8 additions & 9 deletions test/scoped_trace_exception_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
# endif
#endif

#if EXCEPTION_CATCH_TEST

bool no_throw = false;

IUTEST(ScopedTraceExceptionTest, Exception)
Expand Down Expand Up @@ -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)
Expand All @@ -112,8 +107,10 @@ int main(int argc, char* argv[])
IUTEST_ASSERT_NE(IUTEST_RUN_ALL_TESTS(), 0)
<< ::iutest::AssertionReturn<int>(1);

#if !defined(IUTEST_USE_GTEST)
TestLogger logger;
::iutest::detail::iuConsole::SetLogger(&logger);
#endif

try
{
Expand All @@ -130,6 +127,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<int>(1);
IUTEST_ASSERT_STRNOTIN("ScopedTraceExceptionTest Scoped Exception B", logger.c_str())
Expand All @@ -148,14 +146,18 @@ int main(int argc, char* argv[])
<< ::iutest::AssertionReturn<int>(1);
IUTEST_ASSERT_STRNOTIN("ScopedTraceExceptionTest Scoped Assertion B", logger.c_str())
<< ::iutest::AssertionReturn<int>(1);
#endif

no_throw = true;
#if defined(IUTEST_USE_GTEST)
logger.clear();
#endif
{
const int ret = IUTEST_RUN_ALL_TESTS();
if( ret != 0 ) return 1;
}

#if EXCEPTION_CATCH_TEST
IUTEST_ASSERT_STRNOTIN("ScopedTraceExceptionTest Scoped Exception A", logger.c_str())
<< ::iutest::AssertionReturn<int>(1);
IUTEST_ASSERT_STRNOTIN("ScopedTraceExceptionTest Scoped Exception B", logger.c_str())
Expand All @@ -164,11 +166,8 @@ int main(int argc, char* argv[])
<< ::iutest::AssertionReturn<int>(1);
IUTEST_ASSERT_STRNOTIN("ScopedTraceExceptionTest Scoped Exception D", logger.c_str())
<< ::iutest::AssertionReturn<int>(1);

#else
IUTEST_UNUSED_VAR(argc);
IUTEST_UNUSED_VAR(argv);
#endif

printf("*** Successful ***\n");
return 0;
}

0 comments on commit 1ba4c8b

Please sign in to comment.