X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/343325f4cc460b709fc929f85bc2a3d4691d63fe..c72f5c4fb4b1d496a9bbdb421f25e986f0cba9bf:/test/libapt/tagfile_test.cc diff --git a/test/libapt/tagfile_test.cc b/test/libapt/tagfile_test.cc index df618ea16..064e91b79 100644 --- a/test/libapt/tagfile_test.cc +++ b/test/libapt/tagfile_test.cc @@ -34,6 +34,12 @@ TEST(TagFileTest,SingleField) EXPECT_FALSE(section.Exists("FieldB-12345678")); // There is only one section in this tag file EXPECT_FALSE(tfile.Step(section)); + + // Now we scan an empty section to test reset + ASSERT_TRUE(section.Scan("\n\n", 2, true)); + EXPECT_EQ(0, section.Count()); + EXPECT_FALSE(section.Exists("FieldA-12345678")); + EXPECT_FALSE(section.Exists("FieldB-12345678")); } TEST(TagFileTest,MultipleSections) @@ -180,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" @@ -194,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")); @@ -203,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")); @@ -211,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()); }