Fixing empty variable failure for --fail-not-set

This commit is contained in:
Alexey Maslennikov
2017-06-16 15:59:57 +02:00
parent 2b611b8f90
commit 31b2faf135
5 changed files with 23 additions and 5 deletions

View File

@@ -2,7 +2,7 @@
cd "${0%/*}"
unset __NO_SUCH_VAR
../mo --fail-not-set ./fail-not-set-file.template 2>&1
POPULATED="words" EMPTY="" ../mo --fail-not-set ./fail-not-set-file.template 2>&1
if [[ $? -ne 1 ]]; then
echo "Did not return 1"

View File

@@ -1 +1,3 @@
* {{__NO_SUCH_VAR}}
Populated: {{POPULATED}};
Empty: {{EMPTY}};
Unset: {{__NO_SUCH_VAR}};

View File

@@ -1 +1,3 @@
This will fail: Env variable not set: __NO_SUCH_VAR
Populated: words;
Empty: ;
Unset: Env variable not set: __NO_SUCH_VAR

View File

@@ -2,7 +2,11 @@
cd "${0%/*}"
unset __NO_SUCH_VAR
echo "This will fail: {{__NO_SUCH_VAR}}" | ../mo --fail-not-set 2>&1
POPULATED="words" EMPTY="" ../mo --fail-not-set 2>&1 <<EOF
Populated: {{POPULATED}};
Empty: {{EMPTY}};
Unset: {{__NO_SUCH_VAR}};
EOF
if [[ $? -ne 1 ]]; then
echo "Did not return 1"