summaryrefslogtreecommitdiff
path: root/test/aur-test.sh
blob: 1bdd2e445b9ca6cf760354fe51c28c3806b3162d (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 aur

before() {
	tmpdir=$(mktemp -d --tmpdir test-aur.XXXXXXXXXXXX)
	stat=0
}

after() {
	rm -rf -- "$tmpdir"
}

it_displays_help() {
	LANG=C aur -h >$tmpdir/stdout 2>$tmpdir/stderr

	[[ "$(sed 1q $tmpdir/stdout)" =~ Usage:.* ]]
	[[ -z "$(cat $tmpdir/stderr)" ]]
}

it_fails_with_0_args() {
	aur >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?

	[[ $stat != 0 ]]
	[[ -z "$(cat $tmpdir/stdout)" ]]
	[[ -n "$(cat $tmpdir/stderr)" ]]
}

# TODO: I don't have any other tests we can run without networking.