8000 Prefix local variable message in CHECK macros with UnitTest_ to reduc… · Reification/unittest-cpp@27317ec · GitHub
[go: up one dir, main page]

Skip to content

Commit 27317ec

Browse files
Prefix local variable message in CHECK macros with UnitTest_ to reduce the risk of name collisions with application code
1 parent d220612 commit 27317ec

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

UnitTest++/CheckMacros.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@
4545
UT_RETHROW (UnitTest::RequiredCheckException) \
4646
UT_CATCH (std::exception, e, \
4747
{ \
48-
UnitTest::MemoryOutStream message; \
49-
message << "Unhandled exception (" << e.what() << ") in CHECK(" #value ")"; \
48+
UnitTest::MemoryOutStream UnitTest_message; \
49+
UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK(" #value ")"; \
5050
UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
51-
message.GetText()); \
51+
UnitTest_message.GetText()); \
5252
}) \
5353
UT_CATCH_ALL \
5454
({ \
@@ -66,10 +66,10 @@
6666
UT_RETHROW (UnitTest::RequiredCheckException) \
6767
UT_CATCH (std::exception, e, \
6868
{ \
69-
UnitTest::MemoryOutStream message; \
70-
message << "Unhandled exception (" << e.what() << ") in CHECK_EQUAL(" #expected ", " #actual ")"; \
69+
UnitTest::MemoryOutStream UnitTest_message; \
70+
UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK_EQUAL(" #expected ", " #actual ")"; \
7171
UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
72-
message.GetText()); \
72+
UnitTest_message.GetText()); \
7373
}) \
7474
UT_CATCH_ALL \
7575
({ \
@@ -87,10 +87,10 @@
8787
UT_RETHROW (UnitTest::RequiredCheckException) \
8888
UT_CATCH (std::exception, e, \
8989
{ \
90-
UnitTest::MemoryOutStream message; \
91-
message << "Unhandled exception (" << e.what() << ") in CHECK_CLOSE(" #expected ", " #actual ")"; \
90+
UnitTest::MemoryOutStream UnitTest_message; \
91+
UnitTest_message << "Unhandled exception (" <&l 8000 t; e.what() << ") in CHECK_CLOSE(" #expected ", " #actual ")"; \
9292
UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
93-
message.GetText()); \
93+
UnitTest_message.GetText()); \
9494
}) \
9595
UT_CATCH_ALL \
9696
({ \
@@ -108,10 +108,10 @@
108108
UT_RETHROW (UnitTest::RequiredCheckException) \
109109
UT_CATCH (std::exception, e, \
110110
{ \
111-
UnitTest::MemoryOutStream message; \
112-
message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_EQUAL(" #expected ", " #actual ")"; \
111+
UnitTest::MemoryOutStream UnitTest_message; \
112+
UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_EQUAL(" #expected ", " #actual ")"; \
113113
UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
114-
message.GetText()); \
114+
UnitTest_message.GetText()); \
115115
}) \
116116
UT_CATCH_ALL \
117117
({ \
@@ -129,10 +129,10 @@
129129
UT_RETHROW (UnitTest::RequiredCheckException) \
130130
UT_CATCH (std::exception, e, \
131131
{ \
132-
UnitTest::MemoryOutStream message; \
133-
message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"; \
132+
UnitTest::MemoryOutStream UnitTest_message; \
133+
UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"; \
134134
UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
135-
message.GetText()); \
135+
UnitTest_message.GetText()); \
136136
}) \
137137
UT_CATCH_ALL \
138138
({ \
@@ -150,10 +150,10 @@
150150
UT_RETHROW (UnitTest::RequiredCheckException) \
151151
UT_CATCH (std::exception, e, \
152152
{ \
153-
UnitTest::MemoryOutStream message; \
154-
message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY2D_CLOSE(" #expected ", " #actual ")"; \
153+
UnitTest::MemoryOutStream UnitTest_message; \
154+
UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY2D_CLOSE(" #expected ", " #actual ")"; \
155155
UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
156-
message.GetText()); \
156+
UnitTest_message.GetText()); \
157157
}) \
158158
UT_CATCH_ALL \
159159
({ \

0 commit comments

Comments
 (0)
0