forked from kanaka/mal
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_argv_test.sh
More file actions
executable file
·39 lines (31 loc) · 835 Bytes
/
run_argv_test.sh
File metadata and controls
executable file
·39 lines (31 loc) · 835 Bytes
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
#!/bin/bash
#
# Usage: run_argv_test.sh <command line arguments to run mal>
#
# Example: run_argv_test.sh python step6_file.py
#
assert_equal() {
if [ "$1" = "$2" ] ; then
echo "OK: '$1'"
else
echo "FAIL: Expected '$1' but got '$2'"
echo
exit 1
fi
}
if [ -z "$1" ] ; then
echo "Usage: $0 <command line arguments to run mal>"
exit 1
fi
root="$(dirname $0)"
out="$( $@ $root/tests/print_argv.mal aaa bbb ccc | tr -d '\r' )"
assert_equal '("aaa" "bbb" "ccc")' "$out"
# Note: The 'make' implementation cannot handle arguments with spaces in them,
# so for now we skip this test.
#
# out="$( $@ $root/tests/print_argv.mal aaa 'bbb ccc' ddd )"
# assert_equal '("aaa" "bbb ccc" "ddd")' "$out"
out="$( $@ $root/tests/print_argv.mal | tr -d '\r' )"
assert_equal '()' "$out"
echo 'Passed all *ARGV* tests'
echo