Signed-off-by: Benedikt Morbach <benedikt.morbach@googlemail.com> --- src/pacman/package.c | 7 ++----- test/pacman/tests/query010.py | 12 ++++++++++++ test/pacman/tests/query011.py | 15 +++++++++++++++ 3 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 test/pacman/tests/query010.py create mode 100644 test/pacman/tests/query011.py diff --git a/src/pacman/package.c b/src/pacman/package.c index c7bfb14..49192bf 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -59,11 +59,8 @@ static void deplist_display(const char *title, static void optdeplist_display(const char *title, alpm_list_t *optdeps) { - alpm_list_t *i, *text = NULL; - for(i = optdeps; i; i = alpm_list_next(i)) { - alpm_optdepend_t *optdep = i->data; - text = alpm_list_add(text, alpm_optdep_compute_string(optdep)); - } + alpm_list_t *text = NULL; + text = optdep_string_list(optdeps, 1); list_display_linebreak(title, text); FREELIST(text); } diff --git a/test/pacman/tests/query010.py b/test/pacman/tests/query010.py new file mode 100644 index 0000000..76f82d9 --- /dev/null +++ b/test/pacman/tests/query010.py @@ -0,0 +1,12 @@ +self.description = "Query info on a package (optdep install status [uninstalled])" + +optstr = "dep: for foobar" + +pkg = pmpkg("dummy", "1.0-2") +pkg.optdepends = [optstr] +self.addpkg2db("local", pkg) + +self.args = "-Qi %s" % pkg.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PACMAN_OUTPUT=^Optional Deps.*%s$" % optstr) diff --git a/test/pacman/tests/query011.py b/test/pacman/tests/query011.py new file mode 100644 index 0000000..f487fb2 --- /dev/null +++ b/test/pacman/tests/query011.py @@ -0,0 +1,15 @@ +self.description = "Query info on a package (optdep install status [installed])" + +optstr = "dep: for foobar" + +pkg = pmpkg("dummy", "1.0-2") +pkg.optdepends = [optstr] +self.addpkg2db("local", pkg) + +dep = pmpkg("dep") +self.addpkg2db("local", dep) + +self.args = "-Qi %s" % pkg.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PACMAN_OUTPUT=^Optional Deps.*%s \[installed\]$" % optstr) -- 1.7.7.3