Add to test matrix
[jackhill/mal.git] / run_argv_test.sh
1 #!/bin/bash
2
3 #
4 # Usage: run_argv_test.sh <command line arguments to run mal>
5 #
6 # Example: run_argv_test.sh python step6_file.py
7 #
8
9 assert_equal() {
10 if [ "$1" = "$2" ] ; then
11 echo "OK: '$1'"
12 else
13 echo "FAIL: Expected '$1' but got '$2'"
14 echo
15 exit 1
16 fi
17 }
18
19 if [ -z "$1" ] ; then
20 echo "Usage: $0 <command line arguments to run mal>"
21 exit 1
22 fi
23
24 root="$(dirname $0)"
25
26 out="$( $@ $root/tests/print_argv.mal aaa bbb ccc | tr -d '\r' )"
27 assert_equal '("aaa" "bbb" "ccc")' "$out"
28
29 # Note: The 'make' implementation cannot handle arguments with spaces in them,
30 # so for now we skip this test.
31 #
32 # out="$( $@ $root/tests/print_argv.mal aaa 'bbb ccc' ddd )"
33 # assert_equal '("aaa" "bbb ccc" "ddd")' "$out"
34
35 out="$( $@ $root/tests/print_argv.mal | tr -d '\r' )"
36 assert_equal '()' "$out"
37
38 echo 'Passed all *ARGV* tests'
39 echo