]> git.saurik.com Git - apt.git/blobdiff - test/libapt/parsedepends_test.cc
merged from lp:~donkult/apt/experimental
[apt.git] / test / libapt / parsedepends_test.cc
index b7befa561ab0f7c3baabbb6f1781af58dfe8ba37..7b496878ddaf55b50985f22b89a48ed7752b5562 100644 (file)
@@ -21,6 +21,12 @@ int main(int argc,char *argv[]) {
                "apt (>= 0.7.25), "
                "not-for-me [ !dsk ], "
                "only-for-me [ dsk ], "
+               "any-for-me [ any ], "
+               "not-for-darwin [ !darwin-any ], "
+               "cpu-for-me [ any-dsk ], "
+               "os-for-me [ linux-any ], "
+               "cpu-not-for-me [ any-amd64 ], "
+               "os-not-for-me [ kfreebsd-any ], "
                "overlord-dev:any (= 7.15.3~) | overlord-dev:native (>> 7.15.5), "
        ;
 
@@ -100,6 +106,68 @@ test:
                Start++;
        }
 
+       if (ParseArchFlags == true) {
+               Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+               equals("any-for-me", Package);
+               equals("", Version);
+               equals(Null | pkgCache::Dep::NoOp, Op);
+       } else {
+               equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+               Start = strstr(Start, ",");
+               Start++;
+       }
+
+       if (ParseArchFlags == true) {
+               Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+               equals("not-for-darwin", Package);
+               equals("", Version);
+               equals(Null | pkgCache::Dep::NoOp, Op);
+       } else {
+               equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+               Start = strstr(Start, ",");
+               Start++;
+       }
+
+       if (ParseArchFlags == true) {
+               Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+               equals("cpu-for-me", Package);
+               equals("", Version);
+               equals(Null | pkgCache::Dep::NoOp, Op);
+       } else {
+               equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+               Start = strstr(Start, ",");
+               Start++;
+       }
+
+       if (ParseArchFlags == true) {
+               Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+               equals("os-for-me", Package);
+               equals("", Version);
+               equals(Null | pkgCache::Dep::NoOp, Op);
+       } else {
+               equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+               Start = strstr(Start, ",");
+               Start++;
+       }
+
+       if (ParseArchFlags == true) {
+               Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+               equals("", Package); // cpu-not-for-me
+       } else {
+               equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+               Start = strstr(Start, ",");
+               Start++;
+       }
+
+       if (ParseArchFlags == true) {
+               Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+               equals("", Package); // os-not-for-me
+       } else {
+               equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+               Start = strstr(Start, ",");
+               Start++;
+       }
+
        Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
        if (StripMultiArch == true)
                equals("overlord-dev", Package);