diff options
Diffstat (limited to 'src/guile')
-rwxr-xr-x | src/guile/myra-test-utils/driver.scm | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/src/guile/myra-test-utils/driver.scm b/src/guile/myra-test-utils/driver.scm index bfb5a1f..0369fe1 100755 --- a/src/guile/myra-test-utils/driver.scm +++ b/src/guile/myra-test-utils/driver.scm @@ -35,13 +35,14 @@ #:use-module ((srfi srfi-19) #:prefix s19:) #:use-module ((srfi srfi-26) #:select (cut)) #:use-module ((srfi srfi-64) #:prefix s64:) + #:use-module ((myra-test-utils) #:select (%interactive-debugging)) #:export (run-test-driver)) -(define script-version "2023-12-06.16") ;UTC +(define script-version "2023-12-07.08") ;UTC (define (show-help) (display "Usage: - test-driver --test-name=NAME --log-file=PATH --trs-file=PATH + test-driver --test-name=NAME [--log-file=PATH] [--trs-file=PATH] [--expect-failure={yes|no}] [--color-tests={yes|no}] [--select=REGEXP] [--exclude=REGEXP] [--errors-only={yes|no}] [--enable-hard-errors={yes|no}] [--brief={yes|no}}] @@ -257,21 +258,33 @@ cases based on their names." (color-tests (if (assoc 'color-tests opts) (option->boolean opts 'color-tests) #t))) - (when log + (cond + (log (redirect-port log (current-output-port)) (redirect-port log (current-warning-port)) (redirect-port log (current-error-port))) - (s64:test-with-runner - (test-runner-gnu test-name - #:color? color-tests - #:brief? (option->boolean opts 'brief) - #:errors-only? (option->boolean opts 'errors-only) - #:show-duration? (option->boolean - opts 'show-duration) - #:out-port out #:trs-port trs) - (s64:test-apply test-specifier - (lambda _ - (load-from-path test-name)))) + ((false-if-exception (resolve-interface '(ice-9 readline))) + => + (lambda (module) + ;; Enable completion and input history at the REPL. + ((module-ref module 'activate-readline)))) + (else + (display "Consider installing the 'guile-readline' package for +convenient interactive line editing and input history.\n\n" + out))) + (parameterize ((%interactive-debugging (not log))) + (s64:test-with-runner + (test-runner-gnu test-name + #:color? color-tests + #:brief? (option->boolean opts 'brief) + #:errors-only? (option->boolean + opts 'errors-only) + #:show-duration? (option->boolean + opts 'show-duration) + #:out-port out #:trs-port trs) + (s64:test-apply test-specifier + (lambda _ + (load-from-path test-name))))) (and=> log close-port) (and=> trs close-port) (close-port out)))) |