summaryrefslogtreecommitdiff
path: root/test/cases/libredbdiff.bats
blob: 6cebbf6e564e77d04de1e0cda43fcf58d987e5c9 (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
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env roundup

describe libredbdiff
. ./test-common.sh

before() {
	common_before

	install -Dm644 /dev/stdin "$XDG_CONFIG_HOME/libretools/libredbdiff.conf" <<-'eot'
		statedir="$PWD"
		mirror_prbl='https://repo.parabola.nu/$repo/os/$arch'
		mirror_arch='https://mirrors.kernel.org/archlinux/$repo/os/$arch'
		repos=(libre)
		eot
}

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
}

it_fails_on_bad_repo_args() {
	cd libredbdiff.d/statedir

	libredbdiff -n bogus >$tmpdir/stdout 2>$tmpdir/stderr || status=$?

	[[ $status != 0 ]]
	empty $tmpdir/stdout
	not empty $tmpdir/stderr
}