Skip to content

Commit

Permalink
fixup! test/kv-store: add test case for quoted values
Browse files Browse the repository at this point in the history
  • Loading branch information
tormath1 committed Oct 12, 2023
1 parent 7944d3e commit 4b101f6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/update_engine/simple_key_value_store_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ 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<string, string> parts = simple_key_value_store::ParseString(blob);
string combined = simple_key_value_store::AssembleString(parts);
map<string, string> combined_parts =
simple_key_value_store::ParseString(combined);
map<string, string>* maps[] = { &parts, &combined_parts };
for (size_t i = 0; i < arraysize(maps); i++) {
map<string, string>* 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;
Expand All @@ -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;
}
}

Expand Down

0 comments on commit 4b101f6

Please sign in to comment.