2021-12-21 02:42:18 +00:00
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
testDefiningALightningFunctionWorks() {
|
|
|
|
|
echo '
|
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
2021-12-21 06:48:10 +00:00
|
|
|
|
⚡hello() { echo "Hello, World!" ; }
|
|
|
|
|
' > go
|
|
|
|
|
|
|
|
|
|
echo "source $REPO_ROOT/⚡" >> go
|
|
|
|
|
chmod +x go
|
|
|
|
|
|
|
|
|
|
try ./go hello
|
|
|
|
|
assertEquals "Hello, World!" "$STDOUT"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testReferingToALightningFunctionWorks() {
|
|
|
|
|
echo '
|
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
⚡goodbye() { echo Good Bye.; }
|
|
|
|
|
⚡hello() { echo "Hello, World!" ; ⚡goodbye ; }
|
|
|
|
|
' > go
|
|
|
|
|
|
|
|
|
|
echo "source $REPO_ROOT/⚡" >> go
|
|
|
|
|
chmod +x go
|
|
|
|
|
|
|
|
|
|
try ./go hello
|
|
|
|
|
assertContains "$STDOUT" "Hello, World!"
|
|
|
|
|
assertContains "$STDOUT" "Good Bye."
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-21 10:06:18 +00:00
|
|
|
|
testArgumentsArePassedToLightningFunctions() {
|
|
|
|
|
echo '
|
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
⚡hello() { echo "Hello, $@!" ; }
|
|
|
|
|
' > go
|
|
|
|
|
|
|
|
|
|
echo "source $REPO_ROOT/⚡" >> go
|
|
|
|
|
chmod +x go
|
|
|
|
|
|
|
|
|
|
try ./go hello banana
|
|
|
|
|
assertContains "$STDOUT" "Hello, banana!"
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-21 06:48:10 +00:00
|
|
|
|
testDefiningALightningFunctionWorksWithSelector16() {
|
|
|
|
|
echo '
|
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
2021-12-21 02:42:18 +00:00
|
|
|
|
⚡️hello() { echo "Hello, World!" ; }
|
|
|
|
|
' > go
|
|
|
|
|
|
2021-12-21 06:48:10 +00:00
|
|
|
|
echo "source $REPO_ROOT/⚡" >> go
|
2021-12-21 02:42:18 +00:00
|
|
|
|
chmod +x go
|
|
|
|
|
|
|
|
|
|
try ./go hello
|
|
|
|
|
assertEquals "Hello, World!" "$STDOUT"
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-21 06:48:10 +00:00
|
|
|
|
testReferingToALightningFunctionWorksWithSelector16() {
|
|
|
|
|
echo '
|
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
⚡️goodbye() { echo Good Bye.; }
|
|
|
|
|
⚡️hello() { echo "Hello, World!" ; ⚡️goodbye ; }
|
|
|
|
|
' > go
|
|
|
|
|
|
|
|
|
|
echo "source $REPO_ROOT/⚡" >> go
|
|
|
|
|
chmod +x go
|
|
|
|
|
|
|
|
|
|
try ./go hello
|
|
|
|
|
assertContains "$STDOUT" "Hello, World!"
|
|
|
|
|
assertContains "$STDOUT" "Good Bye."
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-21 02:42:18 +00:00
|
|
|
|
source $(dirname $0)/runner
|