From 8434f304d4cb6ffa2228eee9f00b0d1aa2eec664 Mon Sep 17 00:00:00 2001 From: Brandon Cheng Date: Thu, 29 Nov 2018 18:53:02 -0500 Subject: [PATCH] Conditionally show test call Fixes #27 --- genericTester.scm | 12 +++++++----- genericTester.sh | 5 ++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/genericTester.scm b/genericTester.scm index e46d80b..8063cdd 100644 --- a/genericTester.scm +++ b/genericTester.scm @@ -12,16 +12,18 @@ ; to. Ex: "(lambda (student reference) (< (abs (- student reference)) 0.0001)) (define test-assertion (read (current-input-port))) (define show-reference-output (read (current-input-port))) + (define show-test-call (read (current-input-port))) (if (eq? test-output-transform "") (set! test-output-transform (lambda (x) x)) (set! test-output-transform (eval test-output-transform (interaction-environment)))) - ; (display "Testing: (apply " (current-error-port)) - ; (display test-function (current-error-port)) - ; (display " '" (current-error-port)) - ; (display (eval test-arguments (interaction-environment)) (current-error-port)) - ; (display ")\n" (current-error-port)) + (if (eval show-test-call (interaction-environment)) + (begin (display "Running: (apply " (current-error-port)) + (display test-function (current-error-port)) + (display " '" (current-error-port)) + (display (eval test-arguments (interaction-environment)) (current-error-port)) + (display ")\n" (current-error-port)))) ; Load student solution and grab their answer (load student-answers-file) diff --git a/genericTester.sh b/genericTester.sh index 6e235e9..f02f34a 100755 --- a/genericTester.sh +++ b/genericTester.sh @@ -6,6 +6,7 @@ PLEDGE="I confirm that my submitted solutions are the result of my own intellect # Default arguments CHECK_PLEDGE=false SHOW_REFERENCE_OUTPUT="#f" +SHOW_TEST_CALL="#f" testOutputTransform=${testOutputTransform:-(lambda (x) x)} # Parse command line flags @@ -13,6 +14,7 @@ while true; do case "$1" in --check-pledge ) CHECK_PLEDGE=true; shift ;; --show-reference-output ) SHOW_REFERENCE_OUTPUT="#t"; shift ;; + --show-test-call ) SHOW_TEST_CALL="#t"; shift ;; * ) break ;; esac done @@ -25,7 +27,8 @@ stdinToGenericTester=" (list $testArguments)\n $testOutputTransform\n (lambda (student reference) $testAssertion)\n - $SHOW_REFERENCE_OUTPUT\n" + $SHOW_REFERENCE_OUTPUT\n + $SHOW_TEST_CALL\n" RESULT=`echo -e $stdinToGenericTester | plt-r5rs genericTester.scm 2>> DEBUG` # Treat the last line of the output as a fake exit status EXITSTATUS=`echo "$RESULT" | tail -n 1`