summaryrefslogtreecommitdiffstats
path: root/test.sh
blob: ef9c7089c96f1320a57563da70ded46904a38ea2 (plain) (blame)
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
#!/bin/bash

set -e

CONF=$(realpath ./conf)
export CONF_HOME=$(mktemp -d)

conf1=$(mktemp)
conf2=$(mktemp)
conf3=$(mktemp)
conf4=$(mktemp)
conf5=$(mktemp)

echo "test config 1" > "$conf1"
echo "test config 2" > "$conf2"
echo "test config 3" > "$conf3"
echo "test config 4" > "$conf4"
echo "test config 5" > "$conf5"

$CONF add -t "$conf1"
$CONF add "$conf1"
$CONF add -t -g conf "$conf2" "$conf3"
$CONF add -g conf "$conf2" "$conf3"
$CONF add -t -g conf "$conf4"
$CONF add -g conf "$conf4"
$CONF add -t -g other "$conf5"
$CONF add -g other "$conf5"

[ "$($CONF ls -l | wc -l)" != "5" ] && echo Test failed
[ "$($CONF ls | wc -l)" != "8" ] && echo Test failed

rm -rf "$conf1" "$conf2" "$conf3" "$conf4" "$conf5" "$CONF_HOME"
echo PASS