lightning-runner/test/test-arguments
2023-03-05 19:43:28 -08:00

42 lines
659 B
Bash

#!/usr/bin/env bash
testArgumentsBecomeVars() {
echo '
#!/usr/bin/env bash
⚡banana() {
_argument hello
if [[ -n "$_arg_hello" ]]; then
echo "I AM A BANANA"
fi
}
' > go
echo "source $REPO_ROOT/⚡" >> go
chmod +x go
try ./go banana hello=please
assertEquals "I AM A BANANA" "$STDOUT"
}
testArgumentsNotDeclaredDoNot() {
echo '
#!/usr/bin/env bash
⚡banana() {
_argument hello
if [[ -n "$_arg_goodbye" ]]; then
echo "I AM A BANANA"
fi
}
' > go
echo "source $REPO_ROOT/⚡" >> go
chmod +x go
try ./go banana goodbye=foo
assertEquals "" "$STDOUT"
}
source $(dirname $0)/runner