aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-10-21 23:28:03 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2013-10-21 23:28:03 +0200
commit22f0f794ac4e40866c5d390a7b27b8bd6713e681 (patch)
treeda5f9febae11d7819a0d908b9505997575b04628 /test
parent989edff55111db3b457c9e04f3abf296e6ac555c (diff)
downloadapp.sh-22f0f794ac4e40866c5d390a7b27b8bd6713e681.tar.gz
app.sh-22f0f794ac4e40866c5d390a7b27b8bd6713e681.tar.bz2
app.sh-22f0f794ac4e40866c5d390a7b27b8bd6713e681.tar.xz
app.sh-22f0f794ac4e40866c5d390a7b27b8bd6713e681.zip
o Removing silly formatting that left extra spaced at the end of
lines. o Fixing bug in app-conf get subcommand that would only return the first part of values with an equals sign. o Makding sure $HOME is always set.
Diffstat (limited to 'test')
-rwxr-xr-xtest/app-conf.bats43
-rw-r--r--test/utils.bash6
2 files changed, 30 insertions, 19 deletions
diff --git a/test/app-conf.bats b/test/app-conf.bats
index d1a2b18..5c5da05 100755
--- a/test/app-conf.bats
+++ b/test/app-conf.bats
@@ -18,12 +18,12 @@ setup_inner() {
app conf set g.FOO bar
app conf
- eq '${lines[0]}' "app.bin bin/app-a "
- eq '${lines[1]}' "g.FOO bar "
+ eq '${lines[0]}' "app.bin bin/app-a"
+ eq '${lines[1]}' "g.FOO bar"
eq '${#lines[*]}' 2
app conf get g.FOO
- eq '${lines[0]}' "bar"
+ eq '${lines[0]}' "bar"
eq '${#lines[*]}' 1
app conf get g.foo
@@ -33,7 +33,7 @@ setup_inner() {
eq '${#lines[*]}' 0
app conf
- eq '${lines[0]}' "app.bin bin/app-a "
+ eq '${lines[0]}' "app.bin bin/app-a"
eq '${#lines[*]}' 1
}
@@ -42,13 +42,13 @@ setup_inner() {
app conf
eq '${#lines[*]}' 1
- eq '${lines[0]}' "app.bin bin/app-a "
+ eq '${lines[0]}' "app.bin bin/app-a"
}
@test "./app conf wat" {
check_status=no
app conf wat
- eq '${lines[0]}' "Unknown command: wat"
+ eq '${lines[0]}' "Unknown command: wat"
}
@test "./app conf list" {
@@ -56,11 +56,11 @@ setup_inner() {
app conf
eq '${#lines[*]}' 1
- eq '${lines[0]}' "app.bin bin/app-a "
+ eq '${lines[0]}' "app.bin bin/app-a"
app conf list
eq '${#lines[*]}' 1
- eq '${lines[0]}' "app.bin bin/app-a "
+ eq '${lines[0]}' "app.bin bin/app-a"
check_status=no
app conf list foo
@@ -72,7 +72,7 @@ setup_inner() {
echo "foo.bar=awesome" >> .app/config
app conf list
- eq '${lines[0]}' "foo.bar awesome "
+ eq '${lines[0]}' "foo.bar awesome"
eq '${#lines[*]}' 1
}
@@ -98,16 +98,27 @@ setup_inner() {
eq '${#lines[*]}' 0
app conf
- eq '${lines[0]}' "app.bin bin/app-a "
- eq '${lines[1]}' "group.foo bar "
+ eq '${lines[0]}' "app.bin bin/app-a"
+ eq '${lines[1]}' "group.foo bar"
eq '${#lines[*]}' 2
}
+@test "./app conf set - values with '=' and spaces" {
+ echo > .app/config
+ app conf set app.env "JAVA_OPTS=-Xmx1G -Dawesome=true"
+ app_libexec app-cat-conf
+ eq '${lines[0]}' "app.env=JAVA_OPTS=-Xmx1G -Dawesome=true"
+ eq '${#lines[*]}' 1
+ app conf get app.env
+ eq '${lines[0]}' "JAVA_OPTS=-Xmx1G -Dawesome=true"
+ eq '${#lines[*]}' 1
+}
+
@test "./app conf -l app set" {
echo > .app/config
app conf -l app set a.x 2
app_libexec app-cat-conf
- eq '${lines[0]}' "a.x=2"
+ eq '${lines[0]}' "a.x=2"
eq '${#lines[*]}' 1
}
@@ -115,7 +126,7 @@ setup_inner() {
echo > .app/config
app conf -l user set a.x 3
app_libexec app-cat-conf -l user
- eq '${lines[0]}' "a.x=3"
+ eq '${lines[0]}' "a.x=3"
eq '${#lines[*]}' 1
}
@@ -125,11 +136,11 @@ setup_inner() {
echo "foo.bar=2" >> config-b
app conf import config-b
- eq '${lines[0]}' "Importing config from config-b"
+ eq '${lines[0]}' "Importing config from config-b"
eq '${#lines[*]}' 1
app_libexec app-cat-conf
- eq '${lines[0]}' "foo.bar=2"
- eq '${lines[1]}' "foo.baz=1"
+ eq '${lines[0]}' "foo.bar=2"
+ eq '${lines[1]}' "foo.baz=1"
eq '${#lines[*]}' 2
}
diff --git a/test/utils.bash b/test/utils.bash
index f767d90..9979404 100644
--- a/test/utils.bash
+++ b/test/utils.bash
@@ -8,10 +8,10 @@ exit_usage_wrong=0
setup() {
find test/data -name \*.zip | xargs rm -f
+ APPSH_HOME=$(cd $BATS_TEST_DIRNAME/..; echo `pwd`)
ORIG_PATH=$PATH
PATH=/bin:/usr/bin
PATH=$PATH:$APPSH_HOME
- APPSH_HOME=$(cd $BATS_TEST_DIRNAME/..; echo `pwd`)
rm -rf $BATS_TMPDIR/app.sh
mkdir $BATS_TMPDIR/app.sh
@@ -58,7 +58,7 @@ check_status=yes
app() {
echo app $@
- run $APPSH_HOME/app $@
+ run $APPSH_HOME/app "$@"
echo_lines
if [ "$check_status" = yes ]
@@ -74,7 +74,7 @@ app_libexec() {
echo libexec/$@
shift
- run "$x" $@
+ run "$x" "$@"
echo_lines