From 4b101f6f84bb5a4eeb0e24934c841b9a6add21ef Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Thu, 12 Oct 2023 12:55:17 +0200 Subject: [PATCH] fixup! test/kv-store: add test case for quoted values --- src/update_engine/simple_key_value_store_unittest.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/update_engine/simple_key_value_store_unittest.cc b/src/update_engine/simple_key_value_store_unittest.cc index 345bbda..2987537 100644 --- a/src/update_engine/simple_key_value_store_unittest.cc +++ b/src/update_engine/simple_key_value_store_unittest.cc @@ -18,7 +18,7 @@ namespace chromeos_update_engine { class SimpleKeyValueStoreTest : public ::testing::Test {}; TEST(SimpleKeyValueStoreTest, SimpleTest) { - string blob = "A=B\nC=\n=\nFOO=BAR=BAZ\nALIAS='my alias'\nTEST=\"this is a test\"\nBAR=BAX\nMISSING=NEWLINE"; + string blob = "A=B\nC=\n=\nFOO=BAR=BAZ\nALIAS='my alias'\nEMPTY=''\nD=\"\"\nTEST=\"this is a test\"\nBAR=BAX\nMISSING=NEWLINE"; map parts = simple_key_value_store::ParseString(blob); string combined = simple_key_value_store::AssembleString(parts); map combined_parts = @@ -26,7 +26,7 @@ TEST(SimpleKeyValueStoreTest, SimpleTest) { map* maps[] = { &parts, &combined_parts }; for (size_t i = 0; i < arraysize(maps); i++) { map* test_map = maps[i]; - EXPECT_EQ(8, test_map->size()) << "i = " << i; + EXPECT_EQ(10, test_map->size()) << "i = " << i; EXPECT_EQ("B", (*test_map)["A"]) << "i = " << i; EXPECT_EQ("", (*test_map)["C"]) << "i = " << i; EXPECT_EQ("", (*test_map)[""]) << "i = " << i; @@ -35,6 +35,8 @@ TEST(SimpleKeyValueStoreTest, SimpleTest) { EXPECT_EQ("NEWLINE", (*test_map)["MISSING"]) << "i = " << i; EXPECT_EQ("my alias", (*test_map)["ALIAS"]) << "i = " << i; EXPECT_EQ("this is a test", (*test_map)["TEST"]) << "i = " << i; + EXPECT_EQ("", (*test_map)["EMPTY"]) << "i = " << i; + EXPECT_EQ("", (*test_map)["D"]) << "i = " << i; } }