78 lines
1.4 KiB
Bash
78 lines
1.4 KiB
Bash
#!/usr/bin/env bash
|
||
|
||
testDefiningALightningFunctionWorks() {
|
||
echo '
|
||
#!/usr/bin/env bash
|
||
|
||
⚡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."
|
||
}
|
||
|
||
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!"
|
||
}
|
||
|
||
testDefiningALightningFunctionWorksWithSelector16() {
|
||
echo '
|
||
#!/usr/bin/env bash
|
||
|
||
⚡️hello() { echo "Hello, World!" ; }
|
||
' > go
|
||
|
||
echo "source $REPO_ROOT/⚡" >> go
|
||
chmod +x go
|
||
|
||
try ./go hello
|
||
assertEquals "Hello, World!" "$STDOUT"
|
||
}
|
||
|
||
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."
|
||
}
|
||
|
||
source $(dirname $0)/runner
|