summaryrefslogtreecommitdiff
path: root/test/libredbdiff-test.sh
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-05-02 22:20:39 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2017-05-02 22:33:04 -0400
commitc9c5a69cc2098e999ddb76d8fd282a3fb6334cb1 (patch)
tree63c70b7a4a58c9547eab265f5ea2cc58ea4136ef /test/libredbdiff-test.sh
parenta6ef2ffed4af47ff360bf0fc508aa24e83418f97 (diff)
bugfix [1/2]: libredbdiff: Add a test for handling multiple provides.
Also make the minimal changes to the program to make this testing possible.
Diffstat (limited to 'test/libredbdiff-test.sh')
-rw-r--r--test/libredbdiff-test.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/libredbdiff-test.sh b/test/libredbdiff-test.sh
new file mode 100644
index 0000000..1b267e3
--- /dev/null
+++ b/test/libredbdiff-test.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env roundup
+
+describe libredbdiff
+. ./test-common.sh
+
+common_before() {
+ mkdir -p "$XDG_CONFIG_HOME/libretools"
+ printf '%s\n' \
+ 'statedir="$PWD"' \
+ "mirror='http://repo.parabola.nu/\$repo/os/\$arch'" \
+ "mirrorarch='http://mirrors.kernel.org/archlinux/\$repo/os/\$arch'" \
+ > $XDG_CONFIG_HOME/libretools/libredbdiff.conf
+}
+
+it_displays_help() {
+ LC_ALL=C libredbdiff -h >$tmpdir/stdout 2>$tmpdir/stderr
+
+ [[ "$(sed 1q $tmpdir/stdout)" =~ Usage:.* ]]
+ empty $tmpdir/stderr
+}
+
+it_handles_packages_with_multiple_provides() {
+ cd libredbdiff.d/statedir
+
+ libredbdiff -n libre >$tmpdir/stdout 2>$tmpdir/stderr
+
+ empty $tmpdir/stderr
+ diff -w ../expected.txt $tmpdir/stdout
+}