summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/libredbdiff-test.sh29
-rw-r--r--test/libredbdiff.d/expected.txt1
-rw-r--r--test/libredbdiff.d/statedir/pacman.archlinux/local/ALPM_DB_VERSION1
-rw-r--r--test/libredbdiff.d/statedir/pacman.archlinux/sync/core.dbbin0 -> 1017 bytes
-rw-r--r--test/libredbdiff.d/statedir/pacman.conf.archlinux6
-rw-r--r--test/libredbdiff.d/statedir/pacman.conf.parabola6
-rw-r--r--test/libredbdiff.d/statedir/pacman.parabola/local/ALPM_DB_VERSION1
-rw-r--r--test/libredbdiff.d/statedir/pacman.parabola/sync/libre.dbbin0 -> 1062 bytes
8 files changed, 44 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
+}
diff --git a/test/libredbdiff.d/expected.txt b/test/libredbdiff.d/expected.txt
new file mode 100644
index 0000000..8fb89bf
--- /dev/null
+++ b/test/libredbdiff.d/expected.txt
@@ -0,0 +1 @@
+p linux-libre linux 4.10.12_gnu-2 | 4.10.13-1
diff --git a/test/libredbdiff.d/statedir/pacman.archlinux/local/ALPM_DB_VERSION b/test/libredbdiff.d/statedir/pacman.archlinux/local/ALPM_DB_VERSION
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/test/libredbdiff.d/statedir/pacman.archlinux/local/ALPM_DB_VERSION
@@ -0,0 +1 @@
+9
diff --git a/test/libredbdiff.d/statedir/pacman.archlinux/sync/core.db b/test/libredbdiff.d/statedir/pacman.archlinux/sync/core.db
new file mode 100644
index 0000000..b0f737b
--- /dev/null
+++ b/test/libredbdiff.d/statedir/pacman.archlinux/sync/core.db
Binary files differ
diff --git a/test/libredbdiff.d/statedir/pacman.conf.archlinux b/test/libredbdiff.d/statedir/pacman.conf.archlinux
new file mode 100644
index 0000000..d4a9c8d
--- /dev/null
+++ b/test/libredbdiff.d/statedir/pacman.conf.archlinux
@@ -0,0 +1,6 @@
+[options]
+DBPath = ./pacman.archlinux
+Architecture = x86_64
+
+[core]
+Server = https://mirrors.kernel.org/archlinux/$repo/os/$arch
diff --git a/test/libredbdiff.d/statedir/pacman.conf.parabola b/test/libredbdiff.d/statedir/pacman.conf.parabola
new file mode 100644
index 0000000..7b553dd
--- /dev/null
+++ b/test/libredbdiff.d/statedir/pacman.conf.parabola
@@ -0,0 +1,6 @@
+[options]
+DBPath = ./pacman.parabola
+Architecture = x86_64
+
+[libre]
+Server = https://repomirror.parabola.nu/$repo/os/$arch
diff --git a/test/libredbdiff.d/statedir/pacman.parabola/local/ALPM_DB_VERSION b/test/libredbdiff.d/statedir/pacman.parabola/local/ALPM_DB_VERSION
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/test/libredbdiff.d/statedir/pacman.parabola/local/ALPM_DB_VERSION
@@ -0,0 +1 @@
+9
diff --git a/test/libredbdiff.d/statedir/pacman.parabola/sync/libre.db b/test/libredbdiff.d/statedir/pacman.parabola/sync/libre.db
new file mode 100644
index 0000000..1bd5065
--- /dev/null
+++ b/test/libredbdiff.d/statedir/pacman.parabola/sync/libre.db
Binary files differ