Skip to content

Commit

Permalink
update scoped_trace_exception_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
srz-zumix committed Dec 14, 2022
1 parent 56d7589 commit d3e24a3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
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
13 changes: 4 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 Down Expand Up @@ -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<int>(1);
IUTEST_ASSERT_STRNOTIN("ScopedTraceExceptionTest Scoped Exception B", logger.c_str())
Expand All @@ -148,6 +144,7 @@ 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;
logger.clear();
Expand All @@ -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<int>(1);
IUTEST_ASSERT_STRNOTIN("ScopedTraceExceptionTest Scoped Exception B", logger.c_str())
Expand All @@ -164,11 +162,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 d3e24a3

Please sign in to comment.