Skip to content

Commit 25a3629

Browse files
committed
🐛 Fix for unused drop value warning
1 parent dd9009e commit 25a3629

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

include/GUnit/GAssert.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class op {
152152
explicit op(const info& info) : info_{info} {}
153153

154154
template <class TLhs>
155-
comp<TLhs> operator%(const TLhs& lhs) const {
155+
comp<TLhs> operator<<(const TLhs& lhs) const {
156156
return comp<TLhs>{info_, lhs};
157157
}
158158

@@ -176,21 +176,21 @@ struct ret_void {
176176
} // namespace v1
177177
} // namespace testing
178178

179-
#define EXPECT(...) \
180-
(::testing::detail::op<std::true_type>{ \
181-
::testing::detail::info{__FILE__, __LINE__, #__VA_ARGS__, \
182-
::testing::TestPartResult::kNonFatalFailure}} % \
183-
__VA_ARGS__)
184-
185-
#define ASSERT(...) \
186-
if (::testing::detail::op<std::false_type>{ \
187-
::testing::detail::info{__FILE__, __LINE__, #__VA_ARGS__, \
188-
::testing::TestPartResult::kFatalFailure}} % \
189-
__VA_ARGS__) \
190-
::testing::detail::drop{}; \
191-
else \
192-
return ::testing::detail::ret_void{} == \
193-
(::testing::detail::op<std::true_type>{::testing::detail::info{ \
194-
__FILE__, __LINE__, #__VA_ARGS__, \
195-
::testing::TestPartResult::kFatalFailure}} % \
196-
__VA_ARGS__)
179+
#define EXPECT(...) \
180+
(::testing::detail::op<std::true_type>{ \
181+
::testing::detail::info{__FILE__, __LINE__, #__VA_ARGS__, \
182+
::testing::TestPartResult::kNonFatalFailure}} \
183+
<< __VA_ARGS__)
184+
185+
#define ASSERT(...) \
186+
if (::testing::detail::op<std::false_type>{ \
187+
::testing::detail::info{__FILE__, __LINE__, #__VA_ARGS__, \
188+
::testing::TestPartResult::kFatalFailure}} \
189+
<< __VA_ARGS__) \
190+
void(::testing::detail::drop{}); \
191+
else \
192+
return ::testing::detail::ret_void{} == \
193+
(::testing::detail::op<std::true_type>{::testing::detail::info{ \
194+
__FILE__, __LINE__, #__VA_ARGS__, \
195+
::testing::TestPartResult::kFatalFailure}} \
196+
<< __VA_ARGS__)

include/GUnit/GSteps.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ class Steps : public ::testing::EmptyTestEventListener {
388388
return Step<-1, true>{*this, {"Then", File::c_str(), line}, pattern};
389389
}
390390

391-
// clang-format off
391+
// clang-format off
392392
#if defined(__clang__)
393393
#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
394394
#endif

test/GAssert.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ TEST(GAssert, ShouldSupportExpect) {
2929
EXPECT(i < 100) << "message";
3030

3131
EXPECT(42.0 == 42.);
32+
EXPECT(2*21 == i);
3233
}
3334

3435
TEST(GAssert, ShouldSupportASSERT) {
@@ -48,4 +49,5 @@ TEST(GAssert, ShouldSupportASSERT) {
4849
ASSERT(i < 100) << "message";
4950

5051
ASSERT(42.0 == 42.);
52+
ASSERT(2*21 == i);
5153
}

0 commit comments

Comments
 (0)