Correction to test enable/disable behavior.

Hooks for correction to printing out test announcements at inopportune times.

svn: r9754
This commit is contained in:
Kathy Gray 2008-05-08 21:48:02 +00:00
parent 62afb97230
commit c69b4b947e
4 changed files with 45 additions and 42 deletions

View File

@ -11,6 +11,7 @@
profj/libs/java/lang/Object profj/libs/java/lang/array
profj/libs/java/lang/String)
(require "compile.ss" "parameters.ss" "parsers/lexer.ss" "parser.ss"
(lib "test-engine.scm" "test-engine")
(lib "java-tests.scm" "test-engine")
(lib "test-coverage.scm" "test-engine")
(except-in "ast.ss" for) #;"tester.scm"
@ -791,8 +792,8 @@
(lambda ()
(test-ext? (profj-settings-allow-check? settings))
(testcase-ext? (profj-settings-allow-test? settings))
(tests? (profj-settings-run-tests? settings))
(coverage? (and (tests?) (profj-settings-coverage? settings)))
(test-execute (get-preference 'tests:enable? (lambda () #t)))
(coverage? (and (test-execute) (profj-settings-coverage? settings)))
(error-display-handler
(drscheme:debug:make-debug-error-display-handler (error-display-handler)))
(let ((old-current-eval (drscheme:debug:make-debug-eval-handler (current-eval))))
@ -819,7 +820,6 @@
(cond
((and (not require?) (null? mods) tests-run? (null? extras)) (void))
((and (not require?) (null? mods) (not tests-run?))
(when (tests?)
(let* ([test-engine-obj
(make-object (if (testcase-ext?) java-test-base% java-examples-engine%))]
[tc-info (send test-engine-obj get-info)])
@ -853,7 +853,7 @@
(write-special (car out))
(loop (cdr out))))
(newline))
(inner-loop (cdr os)))))))
(inner-loop (cdr os))))))
(set! tests-run? #t)
(loop mods extras require?))
((and (not require?) (null? mods) tests-run?)

View File

@ -274,4 +274,4 @@
(test)
(inner (void) run-test test))))
(provide scheme-test-data test-format test-execute)
(provide scheme-test-data test-format test-execute test-silence)

View File

@ -137,9 +137,11 @@
(send this display-results display-rep display-event-space)]))))
(define/public (display-success port)
(fprintf port "All tests passed!~n"))
(unless (test-silence)
(fprintf port "All tests passed!~n")))
(define/public (display-untested port)
(fprintf port "This program should be tested.~n"))
(unless (test-silence)
(fprintf port "This program should be tested.~n")))
(define/public (display-results rep event-space)
(send test-display install-info test-info)
(cond
@ -164,5 +166,6 @@
(define test-format (make-parameter (lambda (v) (format "~a" v))))
(define test-execute (make-parameter #t))
(define test-silence (make-parameter #f))
(provide test-engine% test-display-textual% test-format test-execute)
(provide test-engine% test-display-textual% test-format test-execute test-silence)

View File

@ -443,7 +443,7 @@ class WeeklyPlanner{
(interact-test
'advanced
(list "int[] x = new int[10];"
"for( int i = 0; i< x.length; i++) x[i]=i;" "x.length" "x[5]")
"for( int i = 0; i< x.length; i++) { x[i]=i; }" "x.length" "x[5]")
(list '(void) '(void) 10 5)
"Array & for loop")