aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Sasha Smundak <asmundak@google.com>2016-07-27 09:42:48 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-07-27 11:15:21 +0000
commit8ef37409879c3f5b93af3a9713f79c9d8a8ea79b (patch)
treedde9b88e0e842761e116660c71fa30f8482967c5
parentadd1b3036f3dbfa7f143ba47eaa8579ef6f58bb0 (diff)
Cleanup: use file_name_string method in tests.
-- MOS_MIGRATED_REVID=128565586
-rw-r--r--src/tools/singlejar/input_jar_random_jars_test.cc5
-rw-r--r--src/tools/singlejar/input_jar_scan_entries_test.h15
2 files changed, 6 insertions, 14 deletions
diff --git a/src/tools/singlejar/input_jar_random_jars_test.cc b/src/tools/singlejar/input_jar_random_jars_test.cc
index 67e6db2042..2112c43660 100644
--- a/src/tools/singlejar/input_jar_random_jars_test.cc
+++ b/src/tools/singlejar/input_jar_random_jars_test.cc
@@ -56,10 +56,7 @@ TEST_F(InputJarRandomJarsTest, ScanAllJars) {
ASSERT_TRUE(cdh->is());
ASSERT_NE(nullptr, lh);
ASSERT_TRUE(lh->is());
- EXPECT_EQ(lh->file_name_length(), cdh->file_name_length());
- EXPECT_NE(lh->file_name_length(), 0);
- EXPECT_EQ(0, strncmp(lh->file_name(), cdh->file_name(),
- lh->file_name_length()));
+ EXPECT_EQ(lh->file_name_string(), cdh->file_name_string());
if ('/' != lh->file_name()[lh->file_name_length() - 1]) {
++file_count;
}
diff --git a/src/tools/singlejar/input_jar_scan_entries_test.h b/src/tools/singlejar/input_jar_scan_entries_test.h
index fea2f48c7f..5900b0c6f9 100644
--- a/src/tools/singlejar/input_jar_scan_entries_test.h
+++ b/src/tools/singlejar/input_jar_scan_entries_test.h
@@ -106,16 +106,12 @@ class InputJarScanEntries : public testing::Test {
ASSERT_TRUE(cdh->is()) << "No expected tag in the Central Directory Entry.";
ASSERT_NE(nullptr, lh) << "No local header.";
ASSERT_TRUE(lh->is()) << "No expected tag in the Local Header.";
- EXPECT_EQ(lh->file_name_length(), cdh->file_name_length());
- EXPECT_NE(lh->file_name_length(), 0);
- std::string lh_name(lh->file_name(), lh->file_name_length());
- std::string cdh_name(cdh->file_name(), cdh->file_name_length());
- EXPECT_EQ(lh_name, cdh_name);
+ EXPECT_EQ(lh->file_name_string(), cdh->file_name_string());
if (!cdh->no_size_in_local_header()) {
EXPECT_EQ(lh->compressed_file_size(), cdh->compressed_file_size())
- << "Entry: " << lh_name;
+ << "Entry: " << lh->file_name_string();
EXPECT_EQ(lh->uncompressed_file_size(), cdh->uncompressed_file_size())
- << "Entry: " << cdh_name;
+ << "Entry: " << cdh->file_name_string();
}
}
@@ -186,9 +182,8 @@ TYPED_TEST_P(InputJarScanEntries, HugeUncompressed) {
while ((cdh = this->input_jar_->NextEntry(&lh))) {
this->SmogCheck(cdh, lh);
if (cdh->file_name_is(kHuge)) {
- std::string entry_name(cdh->file_name(), cdh->file_name_length());
- EXPECT_EQ(huge_size, cdh->uncompressed_file_size()) << "Entry: "
- << entry_name;
+ EXPECT_EQ(huge_size, cdh->uncompressed_file_size())
+ << "Entry: " << cdh->file_name_string();
huge_file_present = true;
}
}