echo '----------------------------------------------' && \
echo 'Testing $@, step file: $+, test file: $(test)' && \
echo 'Running: $(call get_run_prefix,$(impl))../runtest.py $(TEST_OPTS) $(opt_DEFERRABLE) $(opt_OPTIONAL) $(call $(impl)_TEST_OPTS) ../$(test) -- $(call $(impl)_RUNSTEP,$(step),$(+))' && \
- $(call get_run_prefix,$(impl))../runtest.py $(TEST_OPTS) $(opt_DEFERRABLE) $(opt_OPTIONAL) $(call $(impl)_TEST_OPTS) ../$(test) -- $(call $(impl)_RUNSTEP,$(step),$(+)) &&) \
+ $(call get_run_prefix,$(impl))../runtest.py $(TEST_OPTS) $(opt_DEFERRABLE) $(opt_OPTIONAL) $(call $(impl)_TEST_OPTS) ../$(test) -- $(call $(impl)_RUNSTEP,$(step),$(+)) && \
+ $(if $(filter tests/step6_file.mal,$(test)),\
+ echo '----------------------------------------------' && \
+ echo 'Testing ARGV of $@; step file: $+' && \
+ echo 'Running: $(call get_run_prefix,$(impl))../run_argv_test.sh $(call $(impl)_RUNSTEP,$(step),$(+))' && \
+ $(call get_run_prefix,$(impl))../run_argv_test.sh $(call $(impl)_RUNSTEP,$(step),$(+)) && ,\
+ true && ))\
true))
# Allow test, tests, test^STEP, test^IMPL, and test^IMPL^STEP
- Finish guide.md
All Implementations:
- - test that *ARGV* gets set properly
- regular expression matching in runtest
- add re (use in rep) everywhere and use that (to avoid printing)
- per impl tests for step5_tco, or at least a better way of
--- /dev/null
+#!/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 )"
+assert_equal '("aaa" "bbb" "ccc")' "$out"
+
+out="$( $@ $root/tests/print_argv.mal aaa 'bbb ccc' ddd )"
+assert_equal '("aaa" "bbb ccc" "ddd")' "$out"
+
+out="$( $@ $root/tests/print_argv.mal )"
+assert_equal '()' "$out"
+
+echo 'Passed all *ARGV* tests'
+echo