pw_unit_test: Rename lambda args to avoid shadowing
This renames the arguments to the pw_unit_test expectation lambdas from
one-character names which could shadow other locals to more unique
names.
Change-Id: Iafc938ee33df84c1f2d5869a589dacc91dbd9912
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22021
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
diff --git a/pw_unit_test/public/pw_unit_test/framework.h b/pw_unit_test/public/pw_unit_test/framework.h
index 22ff635..b9db35b 100644
--- a/pw_unit_test/public/pw_unit_test/framework.h
+++ b/pw_unit_test/public/pw_unit_test/framework.h
@@ -425,9 +425,14 @@
::pw::unit_test::internal::Framework::Get().ExpectationResult( \
expected, actual, __LINE__, success)
-#define _PW_TEST_OP(expect_or_assert, lhs, rhs, op) \
- expect_or_assert( \
- lhs, rhs, [](const auto& l, const auto& r) { return l op r; }, #op)
+#define _PW_TEST_OP(expect_or_assert, lhs, rhs, op) \
+ expect_or_assert( \
+ lhs, \
+ rhs, \
+ [](const auto& _pw_lhs, const auto& _pw_rhs) { \
+ return _pw_lhs op _pw_rhs; \
+ }, \
+ #op)
// Implement boolean expectations in a C++11-compatible way.
#define _PW_EXPECT_BOOL(expr, value) \
@@ -446,18 +451,22 @@
} \
} while (0)
-#define _PW_TEST_STREQ(expect_or_assert, lhs, rhs) \
- expect_or_assert( \
- lhs, \
- rhs, \
- [](const auto& l, const auto& r) { return std::strcmp(l, r) == 0; }, \
+#define _PW_TEST_STREQ(expect_or_assert, lhs, rhs) \
+ expect_or_assert( \
+ lhs, \
+ rhs, \
+ [](const auto& _pw_lhs, const auto& _pw_rhs) { \
+ return std::strcmp(_pw_lhs, _pw_rhs) == 0; \
+ }, \
"equals")
-#define _PW_TEST_STRNE(expect_or_assert, lhs, rhs) \
- expect_or_assert( \
- lhs, \
- rhs, \
- [](const auto& l, const auto& r) { return std::strcmp(l, r) != 0; }, \
+#define _PW_TEST_STRNE(expect_or_assert, lhs, rhs) \
+ expect_or_assert( \
+ lhs, \
+ rhs, \
+ [](const auto& _pw_lhs, const auto& _pw_rhs) { \
+ return std::strcmp(_pw_lhs, _pw_rhs) != 0; \
+ }, \
"does not equal")
// Alias Test as ::testing::Test for Googletest compatibility.