Merge pull request #532 from dubek/vhdl-fix-defmacro
[jackhill/mal.git] / impls / tests / run_argv_test.sh
CommitLineData
d3c401c1
DM
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
9assert_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
19if [ -z "$1" ] ; then
20 echo "Usage: $0 <command line arguments to run mal>"
21 exit 1
22fi
23
24root="$(dirname $0)"
25
8a19f603 26out="$( $@ $root/print_argv.mal aaa bbb ccc | tr -d '\r' )"
d3c401c1
DM
27assert_equal '("aaa" "bbb" "ccc")' "$out"
28
31cc710f
DM
29# Note: The 'make' implementation cannot handle arguments with spaces in them,
30# so for now we skip this test.
31#
8a19f603 32# out="$( $@ $root/print_argv.mal aaa 'bbb ccc' ddd )"
31cc710f 33# assert_equal '("aaa" "bbb ccc" "ddd")' "$out"
d3c401c1 34
8a19f603 35out="$( $@ $root/print_argv.mal | tr -d '\r' )"
d3c401c1
DM
36assert_equal '()' "$out"
37
38echo 'Passed all *ARGV* tests'
39echo