-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtest.sh
executable file
·46 lines (38 loc) · 1.05 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
# Debug
# export DYLD_PRINT_LIBRARIES=1
# export DYLD_PRINT_LIBRARIES_POST_LAUNCH=1
# export DYLD_PRINT_RPATHS=1
repl_test() {
echo "$1"
TEST_COMMAND="`echo $2 | metacall`"
if echo "$TEST_COMMAND" | grep -q "$3"; then
echo "$TEST_COMMAND"
echo "Passed"
else
echo "Failed"
echo "Commands:"
echo "$2"
echo "Expected: $3"
echo "Received: $TEST_COMMAND"
exit 1
fi
}
echo "Python Tests"
repl_test \
"Running Python Reverse Words Test" \
'load py tests/python/test.py\ninspect\ncall reverse_words("hello world")\nexit' \
"dlrow olleh"
repl_test \
"Running Python Factorial Test" \
"load py tests/python/test.py\ninspect\ncall factorial(3)\nexit" \
"6"
echo "NodeJS Tests"
repl_test \
"Running NodeJS Reverse Words Test" \
'load node tests/node/test.js\ninspect\ncall reverseWord("hello world")\nexit' \
"dlrow olleh"
repl_test \
"Running NodeJS Factorial Test" \
"load node tests/node/test.js\ninspect\ncall factorial(3)\nexit" \
"6"