Skip to content

Commit

Permalink
Avoid DebugString in Tink OSS code.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 589153067
Change-Id: I8c8c9ccc44ad79ba4fb936a2fca1d0a873d525de
  • Loading branch information
tholenst authored and copybara-github committed Dec 8, 2023
1 parent 6f1ea07 commit 11c1464
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tink/hybrid/ecies_aead_hkdf_hybrid_decrypt_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class EciesAeadHkdfHybridDecryptTest : public ::testing::Test {

void TestValidKey(const EciesAeadHkdfPrivateKey& ecies_key) {
auto result(EciesAeadHkdfHybridDecrypt::New(ecies_key));
ASSERT_TRUE(result.ok()) << result.status() << ecies_key.DebugString();
ASSERT_TRUE(result.ok()) << result.status();
std::unique_ptr<HybridDecrypt> hybrid_decrypt(std::move(result.value()));

std::unique_ptr<HybridEncrypt> hybrid_encrypt(std::move(
Expand Down
6 changes: 2 additions & 4 deletions tink/signature/signature_pem_keyset_reader_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,7 @@ TEST(SignaturePemKeysetReaderTest, ReadECDSACorrectPublicKey) {
expected_primary_data->set_value(
GetExpectedEcdsaPublicKeyProto(
EcdsaSignatureEncoding::IEEE_P1363).SerializeAsString());
EXPECT_THAT(keyset->key(0), EqualsKey(expected_primary))
<< "expected key: " << expected_primary.DebugString();
EXPECT_THAT(keyset->key(0), EqualsKey(expected_primary));

// Build the expected secondary key.
Keyset::Key expected_secondary;
Expand All @@ -545,8 +544,7 @@ TEST(SignaturePemKeysetReaderTest, ReadECDSACorrectPublicKey) {
expected_secondary_data->set_value(
GetExpectedEcdsaPublicKeyProto(
EcdsaSignatureEncoding::DER).SerializeAsString());
EXPECT_THAT(keyset->key(1), EqualsKey(expected_secondary))
<< "expected key: " << expected_secondary.DebugString();
EXPECT_THAT(keyset->key(1), EqualsKey(expected_secondary));
}

TEST(SignaturePemKeysetReaderTest, ReadECDSAWrongHashType) {
Expand Down
9 changes: 8 additions & 1 deletion tink/util/test_matchers.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,14 @@ MATCHER_P(EqualsKey, key, "is equals to the expected key") {
arg.key_data().value() == key.key_data().value()) {
return true;
}
*result_listener << arg.DebugString();
*result_listener << "Expected: " << arg.key_id() << ", "
<< arg.output_prefix_type() << arg.key_data().type_url()
<< ", " << arg.key_data().key_material_type() << ", "
<< arg.key_data().value();
*result_listener << "\nActual: " << key.key_id() << ", "
<< key.output_prefix_type() << key.key_data().type_url()
<< ", " << key.key_data().key_material_type() << ", "
<< key.key_data().value();
return false;
}

Expand Down

0 comments on commit 11c1464

Please sign in to comment.