summaryrefslogtreecommitdiff
path: root/test/libapt
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-12-27 21:52:01 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2015-12-27 21:52:01 +0100
commitc72f5c4fb4b1d496a9bbdb421f25e986f0cba9bf (patch)
treeb17bb61d7a8e3deb9dfa9d29f280410a35ab39ee /test/libapt
parentc3c3bd043b262dd5544594abd5e5bd4377a679d6 (diff)
deal with empty values properly in deb822 parser
Regression introduced in 8710a36a01c0cb1648926792c2ad05185535558e, but such fields are unlikely in practice as it is just as simple to not have a field at all with the same result of not having a value. Closes: 808102
Diffstat (limited to 'test/libapt')
-rw-r--r--test/libapt/tagfile_test.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/libapt/tagfile_test.cc b/test/libapt/tagfile_test.cc
index d7030f41a..064e91b79 100644
--- a/test/libapt/tagfile_test.cc
+++ b/test/libapt/tagfile_test.cc
@@ -186,6 +186,7 @@ TEST(TagFileTest, SpacesEverywhere)
"Package: pkgA\n"
"Package: pkgB\n"
"NoSpaces:yes\n"
+ "NoValue:\n"
"TagSpaces\t :yes\n"
"ValueSpaces: \tyes\n"
"BothSpaces \t:\t yes\n"
@@ -200,6 +201,7 @@ TEST(TagFileTest, SpacesEverywhere)
EXPECT_TRUE(section.Scan(content.c_str(), content.size()));
EXPECT_TRUE(section.Exists("Package"));
EXPECT_TRUE(section.Exists("NoSpaces"));
+ EXPECT_TRUE(section.Exists("NoValue"));
EXPECT_TRUE(section.Exists("TagSpaces"));
EXPECT_TRUE(section.Exists("ValueSpaces"));
EXPECT_TRUE(section.Exists("BothSpaces"));
@@ -209,6 +211,7 @@ TEST(TagFileTest, SpacesEverywhere)
EXPECT_TRUE(section.Exists("Multi-Colon"));
EXPECT_EQ("pkgC", section.FindS("Package"));
EXPECT_EQ("yes", section.FindS("NoSpaces"));
+ EXPECT_EQ("", section.FindS("NoValue"));
EXPECT_EQ("yes", section.FindS("TagSpaces"));
EXPECT_EQ("yes", section.FindS("ValueSpaces"));
EXPECT_EQ("yes", section.FindS("BothSpaces"));
@@ -217,5 +220,5 @@ TEST(TagFileTest, SpacesEverywhere)
EXPECT_EQ("yes", section.FindS("Naming Spaces"));
EXPECT_EQ(":yes:", section.FindS("Multi-Colon"));
// overridden values are still present, but not really accessible
- EXPECT_EQ(11, section.Count());
+ EXPECT_EQ(12, section.Count());
}