First go at args

This commit is contained in:
2023-03-05 19:08:55 -08:00
parent b62ef700f4
commit c7be3223b4
4 changed files with 89 additions and 1 deletions

41
test/test-arguments Normal file
View File

@@ -0,0 +1,41 @@
#!/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