diff --git a/.gitignore b/.gitignore index bf77c8f..5a1b4f1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,3 @@ diagnostic.test tests/*.diff spec/ spec-runner/ -demo/sourcing.vars diff --git a/demo/sourcing b/demo/sourcing index 01cfb6a..f9dd47f 100755 --- a/demo/sourcing +++ b/demo/sourcing @@ -4,11 +4,6 @@ cd "$(dirname "$0")" # Go to the script's directory -cat <sourcing.vars -export NAME="Alex" -export ARRAY=( AAA BBB CCC ) -EOF - cat <&2 + exit 1 + fi + ;; + + *) # Every arg that is not a flag or a option should be a file + files+=("$arg") + ;; + esac + done fi - moGetContent moContent "$@" + moGetContent moContent "${files[@]}" moParse "$moContent" "" true ) diff --git a/tests/source.expected b/tests/source.expected new file mode 100644 index 0000000..a3050ef --- /dev/null +++ b/tests/source.expected @@ -0,0 +1,5 @@ +value +* 1 +* 2 +* 3 +AAA BBB diff --git a/tests/source.sh b/tests/source.sh new file mode 100755 index 0000000..806ea73 --- /dev/null +++ b/tests/source.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +cd "${0%/*}" +cat </dev/null 2>&1 +[[ "$?" -ne 1 ]] && echo "mo accepted a non existent file" diff --git a/tests/source.vars b/tests/source.vars new file mode 100644 index 0000000..58b50d3 --- /dev/null +++ b/tests/source.vars @@ -0,0 +1,4 @@ +export VAR=value +export ARR=(1 2 3) +declare -A ASSOC_ARR +export ASSOC_ARR=([a]=AAA [b]=BBB) \ No newline at end of file