summaryrefslogtreecommitdiff
path: root/test/libredbdiff-test.sh
blob: 1b267e391929e42bee21a82cafca334a0bce1b77 (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
#!/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
}