Skip to content

Commit e883ea5

Browse files
committed
test/kv-store: add test case for quoted values
Useful to test when the value contains whitespaces surrounded with quotes/double-quotes. Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
1 parent f9211bc commit e883ea5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/update_engine/simple_key_value_store_unittest.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,25 @@ namespace chromeos_update_engine {
1818
class SimpleKeyValueStoreTest : public ::testing::Test {};
1919

2020
TEST(SimpleKeyValueStoreTest, SimpleTest) {
21-
string blob = "A=B\nC=\n=\nFOO=BAR=BAZ\nBAR=BAX\nMISSING=NEWLINE";
21+
string blob = "A=B\nC=\n=\nFOO=BAR=BAZ\nALIAS='my alias'\nEMPTY=''\nD=\"\"\nTEST=\"this is a test\"\nBAR=BAX\nMISSING=NEWLINE";
2222
map<string, string> parts = simple_key_value_store::ParseString(blob);
2323
string combined = simple_key_value_store::AssembleString(parts);
2424
map<string, string> combined_parts =
2525
simple_key_value_store::ParseString(combined);
2626
map<string, string>* maps[] = { &parts, &combined_parts };
2727
for (size_t i = 0; i < arraysize(maps); i++) {
2828
map<string, string>* test_map = maps[i];
29-
EXPECT_EQ(6, test_map->size()) << "i = " << i;
29+
EXPECT_EQ(10, test_map->size()) << "i = " << i;
3030
EXPECT_EQ("B", (*test_map)["A"]) << "i = " << i;
3131
EXPECT_EQ("", (*test_map)["C"]) << "i = " << i;
3232
EXPECT_EQ("", (*test_map)[""]) << "i = " << i;
3333
EXPECT_EQ("BAR=BAZ", (*test_map)["FOO"]) << "i = " << i;
3434
EXPECT_EQ("BAX", (*test_map)["BAR"]) << "i = " << i;
3535
EXPECT_EQ("NEWLINE", (*test_map)["MISSING"]) << "i = " << i;
36+
EXPECT_EQ("my alias", (*test_map)["ALIAS"]) << "i = " << i;
37+
EXPECT_EQ("this is a test", (*test_map)["TEST"]) << "i = " << i;
38+
EXPECT_EQ("", (*test_map)["EMPTY"]) << "i = " << i;
39+
EXPECT_EQ("", (*test_map)["D"]) << "i = " << i;
3640
}
3741
}
3842

0 commit comments

Comments
 (0)