diff options
author | Julian Andres Klode <jak@debian.org> | 2020-02-26 18:42:13 +0000 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2020-02-26 18:42:13 +0000 |
commit | c38e0047d95305e5984e822f670055cde6aa5f6a (patch) | |
tree | 71eb37d2df34eebc91cffbb46a879bd21a12b8e7 /test | |
parent | a096b580694cb36f29cdbce8f1db797a08e36709 (diff) | |
parent | 62ca61ff4ac794f9c42335d8286343149d4313d1 (diff) |
Merge branch 'pu/misc' into 'master'
Pu/misc
See merge request apt-team/apt!107
Diffstat (limited to 'test')
-rw-r--r-- | test/libapt/tagfile_test.cc | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/libapt/tagfile_test.cc b/test/libapt/tagfile_test.cc index 8823ff781..919b46cdb 100644 --- a/test/libapt/tagfile_test.cc +++ b/test/libapt/tagfile_test.cc @@ -285,3 +285,61 @@ TEST(TagFileTest, Comments) EXPECT_FALSE(tfile.Step(section)); } + +TEST(TagFileTest, EmptyTagName) +{ + FileFd fd; + createTemporaryFile("emptytagname", fd, NULL, "0:\n" +"PACKAGE:0\n" +"\n" +":\n" +"PACKAGE:\n" +"\n" +"PACKAGE:\n" +":\n" +"\n" +"PACKAGE:\n" +":\n" +"Version:1\n" +"\n" +"PACKAGE::\n" + ); + pkgTagFile tfile(&fd); + pkgTagSection section; + ASSERT_TRUE(tfile.Step(section)); + EXPECT_EQ(2u, section.Count()); + EXPECT_TRUE(section.Exists("PACKAGE")); + EXPECT_EQ("0", section.FindS("PACKAGE")); + EXPECT_TRUE(section.Exists("0")); + EXPECT_EQ("", section.FindS("0")); + + ASSERT_TRUE(tfile.Step(section)); + EXPECT_EQ(2u, section.Count()); + EXPECT_TRUE(section.Exists("PACKAGE")); + EXPECT_EQ("", section.FindS("PACKAGE")); + EXPECT_TRUE(section.Exists("")); + EXPECT_EQ("", section.FindS("")); + + ASSERT_TRUE(tfile.Step(section)); + EXPECT_EQ(2u, section.Count()); + EXPECT_TRUE(section.Exists("PACKAGE")); + EXPECT_EQ("", section.FindS("PACKAGE")); + EXPECT_TRUE(section.Exists("")); + EXPECT_EQ("", section.FindS("")); + + ASSERT_TRUE(tfile.Step(section)); + EXPECT_EQ(3u, section.Count()); + EXPECT_TRUE(section.Exists("PACKAGE")); + EXPECT_EQ("", section.FindS("PACKAGE")); + EXPECT_TRUE(section.Exists("")); + EXPECT_EQ("", section.FindS("")); + EXPECT_TRUE(section.Exists("Version")); + EXPECT_EQ("1", section.FindS("Version")); + + ASSERT_TRUE(tfile.Step(section)); + EXPECT_EQ(1u, section.Count()); + EXPECT_TRUE(section.Exists("PACKAGE")); + EXPECT_EQ(":", section.FindS("PACKAGE")); + + EXPECT_FALSE(tfile.Step(section)); +} |