aboutsummaryrefslogtreecommitdiff
path: root/test/app-cat-conf.bats
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-01-26 23:58:22 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2013-01-26 23:58:22 +0100
commit110ffae47db27a49bbc43f86ba3737bccc1b3085 (patch)
treed74934b12e2904b8aff5fe87421a6501b8ea5c8e /test/app-cat-conf.bats
parentca27d6f6d9ccc35bf55db3d360d1d464d5e206e7 (diff)
downloadapp.sh-110ffae47db27a49bbc43f86ba3737bccc1b3085.tar.gz
app.sh-110ffae47db27a49bbc43f86ba3737bccc1b3085.tar.bz2
app.sh-110ffae47db27a49bbc43f86ba3737bccc1b3085.tar.xz
app.sh-110ffae47db27a49bbc43f86ba3737bccc1b3085.zip
o Rewriting most of this stuff to make it feel more like git.
Diffstat (limited to 'test/app-cat-conf.bats')
-rwxr-xr-xtest/app-cat-conf.bats56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/app-cat-conf.bats b/test/app-cat-conf.bats
new file mode 100755
index 0000000..a95049a
--- /dev/null
+++ b/test/app-cat-conf.bats
@@ -0,0 +1,56 @@
+#!/usr/bin/env bats
+# vim: set filetype=sh:
+
+load utils
+
+setup_inner() {
+ export APPSH_DEFAULT_CONFIG=/dev/null
+}
+
+@test "app-cat-conf" {
+ app_libexec app-cat-conf -f $APPSH_HOME/test/data/app-cat-conf/config-1
+ echo_lines
+ eq '${lines[0]}' "baz.kiz=zap"
+ eq '${lines[1]}' "baz.wat=baz"
+ eq '${lines[2]}' "foo.bar=wat"
+ eq '${lines[3]}' "foo.baz=kaz"
+ eq '${lines[4]}' "foo.wat=foo"
+ eq '${#lines[*]}' 5
+}
+
+@test "app-cat-conf -g baz" {
+ app_libexec app-cat-conf -f $APPSH_HOME/test/data/app-cat-conf/config-1 -n "baz\..*"
+ echo_lines
+ eq '${lines[0]}' "baz.kiz=zap"
+ eq '${lines[1]}' "baz.wat=baz"
+ eq '${#lines[*]}' 2
+}
+
+@test "app-cat-conf -k wat" {
+ app_libexec app-cat-conf -f $APPSH_HOME/test/data/app-cat-conf/config-1 -n ".*\.wat"
+ echo_lines
+ eq '${lines[0]}' "baz.wat=baz"
+ eq '${lines[1]}' "foo.wat=foo"
+ eq '${#lines[*]}' 2
+}
+
+@test "app-cat-conf -g baz -k wat" {
+ app_libexec app-cat-conf -f $APPSH_HOME/test/data/app-cat-conf/config-1 -n "baz\.wat"
+ echo_lines
+ eq '${lines[0]}' "baz.wat=baz"
+ eq '${#lines[*]}' 1
+}
+
+@test "uses \$APPSH_DEFAULT_CONFIG" {
+ APPSH_DEFAULT_CONFIG=$APPSH_HOME/test/data/app-cat-conf/config-2
+ app_libexec app-cat-conf -f /dev/null
+ echo_lines
+ eq '${lines[0]}' "foo.bar=wat"
+ eq '${#lines[*]}' 1
+
+ app_libexec app-cat-conf -f $APPSH_HOME/test/data/app-cat-conf/config-3
+ echo_lines
+ eq '${lines[0]}' "foo.bar=baz"
+ eq '${lines[1]}' "foo.wat=bar"
+ eq '${#lines[*]}' 2
+}