summaryrefslogtreecommitdiff
path: root/test/libredbdiff-test.sh
blob: 8602b5ccbac15fe60103c72134cc18100556766b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env roundup

describe libredbdiff
. ./test-common.sh

common_before() {
	mkdir -p "$XDG_CONFIG_HOME/libretools"
	printf '%s\n' \
	       'statedir="$PWD"' \
	       "mirror_prbl='http://repo.parabola.nu/\$repo/os/\$arch'" \
	       "mirror_arch='http://mirrors.kernel.org/archlinux/\$repo/os/\$arch'" \
	       'repos=(libre)' \
	       > $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_explicit() {
	cd libredbdiff.d/statedir

	libredbdiff -n libre >$tmpdir/stdout 2>$tmpdir/stderr

	empty $tmpdir/stderr
	diff -w ../expected-explicit.txt $tmpdir/stdout
}

it_handles_packages_with_multiple_provides_implicit() {
	cd libredbdiff.d/statedir

	libredbdiff -n >$tmpdir/stdout 2>$tmpdir/stderr

	empty $tmpdir/stderr
	diff -w ../expected-implicit.txt $tmpdir/stdout
}