summaryrefslogtreecommitdiff
path: root/test/toru-path-test.sh
blob: d215cb57189f6c0279f84bb5fcfccd19df3397c9 (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
#!/usr/bin/env roundup

describe toru-path
. ./test-common.sh

it_runs() {
	mkdir -p "$XDG_CONFIG_HOME"/libretools
	printf 'TORUPATH=%q\n' "$tmpdir" >> "$XDG_CONFIG_HOME"/libretools/libretools.conf
	echo 'REPOS=(libre)' >> "$XDG_CONFIG_HOME"/libretools/libretools.conf
	printf 'ABSROOT=%q\n' "$PWD/toru.d" >> "$HOME"/.abs.conf

	toru-path

	tcamgr list "$tmpdir/paths.tch"|LC_COLLATE=C sort|while read -r key; do
		val="$(tcamgr get "$tmpdir/paths.tch" "$key")"
		printf '«%q» -> «%q»\n' "$key" "$val"
	done > "$tmpdir/paths-actual.txt"

	printf '«%q» -> «%q»\n' \
	       BAR "$PWD/toru.d/libre/split-base" \
	       BAZ "$PWD/toru.d/libre/split-base" \
	       FOO "$PWD/toru.d/libre/split-base" \
	       bar "$PWD/toru.d/libre/split" \
	       baz "$PWD/toru.d/libre/split" \
	       foo "$PWD/toru.d/libre/split" \
	       simple "$PWD/toru.d/libre/simple" \
	       split-base "$PWD/toru.d/libre/split-base" \
	       > "$tmpdir/paths-expected.txt"

	diff "$tmpdir/paths-expected.txt" "$tmpdir/paths-actual.txt"
}