1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-23 00:08:50 -05:00

Add more pactests to increase code coverage

These new tests test the following ops at least once:
-Ss, -Si, -Sl, -Sp, -Qs, -Qi, -T

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2007-12-02 17:56:48 -06:00
parent 0b6d73a5b4
commit e8eff3ef97
9 changed files with 96 additions and 1 deletions

View File

@ -0,0 +1,20 @@
self.description = "test deptest (-T) functionality"
sp1 = pmpkg("pkg1")
sp1.depends = ["dep"]
self.addpkg2db("sync", sp1)
sp1dep = pmpkg("dep")
self.addpkg2db("sync", sp1dep)
sp2 = pmpkg("pkg2")
self.addpkg2db("sync", sp2)
lp2 = pmpkg("pkg2")
self.addpkg2db("local", lp2)
self.args = "-T pkg1 pkg2"
self.addrule("PACMAN_RETCODE=127")
self.addrule("PACMAN_OUTPUT=pkg1")
self.addrule("!PACMAN_OUTPUT=pkg2")

View File

@ -7,4 +7,4 @@ self.addpkg2db("local", p)
self.args = "-Q %s" % p.name self.args = "-Q %s" % p.name
self.addrule("PACMAN_RETCODE=0") self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=foobar") self.addrule("PACMAN_OUTPUT=%s" % p.name)

10
pactest/tests/query002.py Normal file
View File

@ -0,0 +1,10 @@
self.description = "Query info on a package"
p = pmpkg("foobar")
p.files = ["bin/foobar"]
self.addpkg2db("local", p)
self.args = "-Qi %s" % p.name
self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=%s" % p.name)

10
pactest/tests/query003.py Normal file
View File

@ -0,0 +1,10 @@
self.description = "Query search for a package"
p = pmpkg("foobar")
p.files = ["bin/foobar"]
self.addpkg2db("local", p)
self.args = "-Qs %s" % p.name
self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=%s" % p.name)

10
pactest/tests/query004.py Normal file
View File

@ -0,0 +1,10 @@
self.description = "Query a package"
p = pmpkg("foobar")
p.files = ["bin/foobar"]
self.addpkg2db("local", p)
self.args = "-Q %s" % p.name
self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=%s" % p.name)

11
pactest/tests/sync1100.py Normal file
View File

@ -0,0 +1,11 @@
self.description = "Get info on package from a sync db"
sp = pmpkg("dummy")
sp.files = ["bin/dummy",
"usr/man/man1/dummy.1"]
self.addpkg2db("sync", sp)
self.args = "-Si %s" % sp.name
self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=%s" % sp.name)

11
pactest/tests/sync1101.py Normal file
View File

@ -0,0 +1,11 @@
self.description = "Search for package from a sync db"
sp = pmpkg("dummy")
sp.files = ["bin/dummy",
"usr/man/man1/dummy.1"]
self.addpkg2db("sync", sp)
self.args = "-Ss %s" % sp.name
self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=%s" % sp.name)

12
pactest/tests/sync1102.py Normal file
View File

@ -0,0 +1,12 @@
self.description = "Get URL on package from a sync db"
sp = pmpkg("dummy")
sp.files = ["bin/dummy",
"usr/man/man1/dummy.1"]
self.addpkg2db("sync", sp)
self.args = "-Sp %s" % sp.name
self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=%s" % sp.name)
self.addrule("PACMAN_OUTPUT=file://")

11
pactest/tests/sync1103.py Normal file
View File

@ -0,0 +1,11 @@
self.description = "Get package list from sync dbs"
sp = pmpkg("dummy")
sp.files = ["bin/dummy",
"usr/man/man1/dummy.1"]
self.addpkg2db("sync", sp)
self.args = "-Sl"
self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=%s" % sp.name)