test(generator): make failures more readable#7019
Conversation
Using a `TestWithParam<absl::string_view>` produces very unreadable failures: the string view is printed one character at a time. And we should use `ASSSERT_STATUS_OK()` before using an `StatusOr<T>`.
|
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
Codecov Report
@@ Coverage Diff @@
## main #7019 +/- ##
==========================================
- Coverage 94.54% 94.54% -0.01%
==========================================
Files 1305 1305
Lines 114705 114704 -1
==========================================
- Hits 108449 108445 -4
- Misses 6256 6259 +3
Continue to review full report at Codecov.
|
dbolduc
left a comment
There was a problem hiding this comment.
Reviewed 1 of 1 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @coryan)
generator/integration_tests/generator_integration_test.cc, line 148 at r1 (raw file):
TEST_P(GeneratorIntegrationTest, CompareGeneratedToGolden) { auto golden_file = ReadFile(absl::StrCat(golden_path_, GetParam())); EXPECT_THAT(golden_file, IsOk());
in description you say we should use ASSERT_STATUS_OK(). Why not do it now?
generator/integration_tests/generator_integration_test.cc, line 152 at r1 (raw file):
ReadFile(absl::StrCat(output_path_, product_path_, GetParam())); ASSERT_THAT(generated_file, IsOk());
same here
coryan
left a comment
There was a problem hiding this comment.
PTAL
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @dbolduc)
generator/integration_tests/generator_integration_test.cc, line 148 at r1 (raw file):
Previously, dbolduc (Darren Bolduc) wrote…
in description you say we should use
ASSERT_STATUS_OK(). Why not do it now?
Done.
generator/integration_tests/generator_integration_test.cc, line 152 at r1 (raw file):
Previously, dbolduc (Darren Bolduc) wrote…
same here
ASSERT_THAT(..., IsOk()) is equivalent to ASSERT_STATUS_OK(...); 🤷
|
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
dbolduc
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @dbolduc)
generator/integration_tests/generator_integration_test.cc, line 152 at r1 (raw file):
Previously, coryan (Carlos O'Ryan) wrote…
ASSERT_THAT(..., IsOk())is equivalent toASSERT_STATUS_OK(...);🤷
Sorry, I misread what you said in the PR description.
Using a
TestWithParam<absl::string_view>produces very unreadablefailures: the string view is printed one character at a time. And we
should use
ASSSERT_STATUS_OK()before using anStatusOr<T>.This change is