aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/singlejar/combiners_test.cc
diff options
context:
space:
mode:
authorGravatar Sasha Smundak <asmundak@google.com>2016-08-09 17:17:57 +0000
committerGravatar Yue Gan <yueg@google.com>2016-08-10 08:37:31 +0000
commit3f814d72af4c86edfe997a5bb2217e6f753f16b1 (patch)
tree3920b3dbe20474609d8229985ed0dc2dc94501a8 /src/tools/singlejar/combiners_test.cc
parent2e6c76e27125a4326e25dd7375f9a1058d30da9d (diff)
Combiners overhaul: introduce Combiner interface common to all combiners, use it instead of switch statement in output_jar. Move implementations to combiners.cc
-- MOS_MIGRATED_REVID=129763019
Diffstat (limited to 'src/tools/singlejar/combiners_test.cc')
-rw-r--r--src/tools/singlejar/combiners_test.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/tools/singlejar/combiners_test.cc b/src/tools/singlejar/combiners_test.cc
index 9b6701c9ea..f6da247721 100644
--- a/src/tools/singlejar/combiners_test.cc
+++ b/src/tools/singlejar/combiners_test.cc
@@ -118,6 +118,13 @@ TEST_F(CombinersTest, ConcatenatorHuge) {
free(reinterpret_cast<void *>(entry));
}
+// Test NullCombiner.
+TEST_F(CombinersTest, NullCombiner) {
+ NullCombiner null_combiner;
+ ASSERT_TRUE(null_combiner.Merge(nullptr, nullptr));
+ ASSERT_EQ(nullptr, null_combiner.OutputEntry());
+}
+
// Test XmlCombiner.
TEST_F(CombinersTest, XmlCombiner) {
InputJar input_jar;
@@ -155,6 +162,7 @@ TEST_F(CombinersTest, XmlCombiner) {
free(reinterpret_cast<void *>(entry));
}
+
// Test PropertyCombiner.
TEST_F(CombinersTest, PropertyCombiner) {
static char kProperties[] =
@@ -165,6 +173,9 @@ TEST_F(CombinersTest, PropertyCombiner) {
property_combiner.AddProperty(std::string("name_str"),
std::string("value_str"));
+ // Merge should not be called.
+ ASSERT_FALSE(property_combiner.Merge(nullptr, nullptr));
+
// Create output, verify Local Header contents.
LH *entry = reinterpret_cast<LH *>(property_combiner.OutputEntry());
EXPECT_TRUE(entry->is());