]> git.saurik.com Git - apt.git/blobdiff - test/libapt/parsedepends_test.cc
CMake: Translations: Build .pot in po binary dir, not project one
[apt.git] / test / libapt / parsedepends_test.cc
index 1e0afb66c0662a42a4261badc09a0fa4d7d1311f..f537542b4b810b2c984cfbaf99c304f8ef57cdd1 100644 (file)
@@ -23,7 +23,7 @@ static void parseDependency(bool const StripMultiArch,  bool const ParseArchFlag
       "libdb-dev:any, "
       "gettext:native (<= 0.12), "
       "libcurl4-gnutls-dev:native | libcurl3-gnutls-dev (>> 7.15.5), "
-      "debiandoc-sgml, "
+      "docbook-xml, "
       "apt (>= 0.7.25), "
       "not-for-me [ !amd64 ], "
       "only-for-me [ amd64 ], "
@@ -31,11 +31,14 @@ static void parseDependency(bool const StripMultiArch,  bool const ParseArchFlag
       "not-for-darwin [ !darwin-any ], "
       "cpu-for-me [ any-amd64 ], "
       "os-for-me [ linux-any ], "
+      "libc-for-me [ gnu-linux-any ], "
+      "libc-not-for-me [ musl-linux-any ], "
       "cpu-not-for-me [ any-armel ], "
       "os-not-for-me [ kfreebsd-any ], "
-      "not-in-stage1 <!profile.stage1>, "
-      "not-in-stage1-or-nodoc <!profile.nodoc !profile.stage1>, "
-      "only-in-stage1 <unknown.unknown profile.stage1>, "
+      "not-in-stage1 <!stage1>, "
+      "not-stage1-and-not-nodoc <!nodoc !stage1>, "
+      "not-stage1-or-not-nodoc <!nodoc> <!stage1>, "
+      "unknown-profile <unknown stage1>, "
       "overlord-dev:any (= 7.15.3~) | overlord-dev:native (>> 7.15.5), "
       ;
 
@@ -82,7 +85,7 @@ static void parseDependency(bool const StripMultiArch,  bool const ParseArchFlag
    EXPECT_EQ(Null | pkgCache::Dep::Greater, Op);
 
    Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
-   EXPECT_EQ("debiandoc-sgml", Package);
+   EXPECT_EQ("docbook-xml", Package);
    EXPECT_EQ("", Version);
    EXPECT_EQ(Null | pkgCache::Dep::NoOp, Op);
 
@@ -155,6 +158,26 @@ static void parseDependency(bool const StripMultiArch,  bool const ParseArchFlag
       Start++;
    }
 
+   if (ParseArchFlags == true) {
+      Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
+      EXPECT_EQ("libc-for-me", Package);
+      EXPECT_EQ("", Version);
+      EXPECT_EQ(Null | pkgCache::Dep::NoOp, Op);
+   } else {
+      EXPECT_EQ(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
+      Start = strstr(Start, ",");
+      Start++;
+   }
+
+   if (ParseArchFlags == true) {
+      Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
+      EXPECT_EQ("", Package); // libc-not-for-me
+   } else {
+      EXPECT_EQ(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
+      Start = strstr(Start, ",");
+      Start++;
+   }
+
    if (ParseArchFlags == true) {
       Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
       EXPECT_EQ("", Package); // cpu-not-for-me
@@ -184,7 +207,7 @@ static void parseDependency(bool const StripMultiArch,  bool const ParseArchFlag
 
    if (ParseRestrictionsList == true) {
       Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
-      EXPECT_EQ("", Package); // not-in-stage1-or-in-nodoc
+      EXPECT_EQ("", Package); // not-stage1-and-not-nodoc
    } else {
       EXPECT_EQ(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
       Start = strstr(Start, ",");
@@ -193,7 +216,16 @@ static void parseDependency(bool const StripMultiArch,  bool const ParseArchFlag
 
    if (ParseRestrictionsList == true) {
       Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
-      EXPECT_EQ("only-in-stage1", Package);
+      EXPECT_EQ("not-stage1-or-not-nodoc", Package);
+   } else {
+      EXPECT_EQ(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
+      Start = strstr(Start, ",");
+      Start++;
+   }
+
+   if (ParseRestrictionsList == true) {
+      Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList);
+      EXPECT_EQ("", Package); // unknown-profile
    } else {
       EXPECT_EQ(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch, ParseRestrictionsList));
       Start = strstr(Start, ",");
@@ -232,10 +264,11 @@ test:
       SCOPED_TRACE(std::string("ParseRestrictionsList: ") + (ParseRestrictionsList ? "true" : "false"));
       parseDependency(StripMultiArch, ParseArchFlags, ParseRestrictionsList);
    }
-   if (StripMultiArch == false)
-      if (ParseArchFlags == false)
-        ParseRestrictionsList = !ParseRestrictionsList;
-   ParseArchFlags = !ParseArchFlags;
+   if (StripMultiArch == false) {
+       if (ParseArchFlags == false)
+           ParseRestrictionsList = !ParseRestrictionsList;
+       ParseArchFlags = !ParseArchFlags;
+   }
    StripMultiArch = !StripMultiArch;
 
    runner++;