mirror of
https://github.com/tests-always-included/mo.git
synced 2025-11-19 23:34:32 +01:00
Add test for --source flag and pull request suggestions
Add a demo/sourcing.vars file to be used by the associated demo script. Modified mo argument parsing so that --help and --source=file do not need to be the first arguments for mo. And can in fact appear after or in the middle of filenames.
This commit is contained in:
5
tests/source.expected
Normal file
5
tests/source.expected
Normal file
@@ -0,0 +1,5 @@
|
||||
value
|
||||
* 1
|
||||
* 2
|
||||
* 3
|
||||
AAA BBB
|
||||
17
tests/source.sh
Executable file
17
tests/source.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cd "${0%/*}"
|
||||
cat <<EOF | ../mo --source=source.vars
|
||||
{{VAR}}
|
||||
{{#ARR}}
|
||||
* {{.}}
|
||||
{{/ARR}}
|
||||
{{ASSOC_ARR.a}} {{ASSOC_ARR.b}}
|
||||
EOF
|
||||
|
||||
|
||||
# Prints the string should mo NOT fail. Meaning that the output will not match
|
||||
# tests/source.expected and therefore the test will fail.
|
||||
|
||||
../mo --source=a/non/existent/file files >/dev/null 2>&1
|
||||
[[ "$?" -ne 1 ]] && echo "mo accepted a non existent file"
|
||||
4
tests/source.vars
Normal file
4
tests/source.vars
Normal file
@@ -0,0 +1,4 @@
|
||||
export VAR=value
|
||||
export ARR=(1 2 3)
|
||||
declare -A ASSOC_ARR
|
||||
export ASSOC_ARR=([a]=AAA [b]=BBB)
|
||||
Reference in New Issue
Block a user