diff options
author | wiktorg <wiktorg@google.com> | 2022-12-16 05:56:46 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-12-16 05:57:29 -0800 |
commit | 09d8227d5bb04d43e5ae9c90b411a30fa1d776e3 (patch) | |
tree | a3f61456eda6cb6053504b4097022e3087f268d9 /cc/util | |
parent | fe46f1c40bd6d73ee3850d7c7b279a8cc9304277 (diff) | |
download | tink-09d8227d5bb04d43e5ae9c90b411a30fa1d776e3.tar.gz |
Remove now redundant `static_cast`s
All `StatusIs` matcher usages in Tink have been migrated to `absl::StatusCode`.
Hopefully no user depends on this; if so we recommend users to migrate by replacing the call to "StatusIs" with the Tink error code with the corresponding absl::StatusCode.
#tinkApiChange
PiperOrigin-RevId: 495854000
Diffstat (limited to 'cc/util')
-rw-r--r-- | cc/util/test_matchers.h | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/cc/util/test_matchers.h b/cc/util/test_matchers.h index ec050e350..0a83996a0 100644 --- a/cc/util/test_matchers.h +++ b/cc/util/test_matchers.h @@ -133,26 +133,20 @@ IsOkAndHolds(InnerMatcher&& inner_matcher) { std::forward<InnerMatcher>(inner_matcher)); } -// Matches a Status with the specified 'code' as error_code(). -// TODO(lizatretyakova): remove the static_cast and fix the comment above to -// use code() after all StatusIs usages are migrated to use absl::StatusCode. +// Matches a Status with the specified 'code' as code(). MATCHER_P(StatusIs, code, - "is a Status with a " + - absl::StatusCodeToString(static_cast<absl::StatusCode>(code)) + - " code") { - if (arg.code() == static_cast<absl::StatusCode>(code)) { + "is a Status with a " + absl::StatusCodeToString(code) + " code") { + if (arg.code() == code) { return true; } *result_listener << ::testing::PrintToString(arg); return false; } -// Matches a Status whose error_code() equals 'code', and whose -// error_message() matches 'message_macher'. -// TODO(lizatretyakova): remove the static_cast and fix the comment above to -// use code() after all StatusIs usages are migrated to use absl::StatusCode. +// Matches a Status whose code() equals 'code', and whose message() matches +// 'message_macher'. MATCHER_P2(StatusIs, code, message_matcher, "") { - return (arg.code() == static_cast<absl::StatusCode>(code)) && + return (arg.code() == code) && testing::Matches(message_matcher)(std::string(arg.message())); } |