Adding mechanism to test command-line variables

This commit is contained in:
Tyler Akins 2016-07-21 07:06:39 -05:00
parent a1e22f1814
commit 600f5c5725
3 changed files with 22 additions and 3 deletions

View File

@ -10,9 +10,16 @@ for TEST in tests/*.expected; do
BASE="${TEST%.expected}"
echo -n "$BASE ... "
echo "Do not read this input" | (
(
if [[ -f "${BASE}.sh" ]]; then
# Run a shell script if one exists
"${BASE}.sh"
else
# Fall back to using .env and .template
. "${BASE}.env"
mo "${BASE}.template"
echo "Do not read this input" | mo "${BASE}.template"
fi
) | diff -wU5 - "${TEST}" > "${BASE}.diff"
if [[ $? -ne 0 ]]; then

8
tests/help.expected Normal file
View File

@ -0,0 +1,8 @@
Mo is a mustache template rendering software written in bash. It inserts
environment variables into templates.
Simply put, mo will change {{VARIABLE}} into the value of that
environment variable. You can use {{#VARIABLE}}content{{/VARIABLE}} to
conditionally display content or iterate over the values of an array.
Learn more about mustache templates at https://mustache.github.io/

4
tests/help.sh Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
cd "${0%/*}"
../mo --help