Skip to content

Commit c5474cd

Browse files
authored
[Offload] Make ASSERT_ERROR output more readable (#157653)
1 parent 8fab811 commit c5474cd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

offload/unittests/OffloadAPI/common/Fixtures.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,16 @@
4040
} while (0)
4141
#endif
4242

43-
// TODO: rework this so the EXPECTED/ACTUAL results are readable
4443
#ifndef ASSERT_ERROR
4544
#define ASSERT_ERROR(EXPECTED, ACTUAL) \
4645
do { \
4746
ol_result_t Res = ACTUAL; \
48-
ASSERT_TRUE(Res && (Res->Code == EXPECTED)); \
47+
if (!Res) \
48+
GTEST_FAIL() << #ACTUAL " succeeded when we expected it to fail"; \
49+
if (Res->Code != EXPECTED) \
50+
GTEST_FAIL() << #ACTUAL " was expected to return " \
51+
<< #EXPECTED " but instead returned " << Res->Code << ": " \
52+
<< Res->Details; \
4953
} while (0)
5054
#endif
5155

0 commit comments

Comments
 (0)