fix stepper test-engine unclosed input-port (in windows) problem

This commit is contained in:
Stephen Chang 2011-07-24 12:19:05 -04:00
parent 8956364387
commit 7e933ee8a4

View File

@ -123,6 +123,8 @@
models)] models)]
[else (test-sequence models exp-str expected-steps extra-files error-box)])) [else (test-sequence models exp-str expected-steps extra-files error-box)]))
(define port null)
;; test-sequence : ll-model? string? steps? extra-files? -> (void) ;; test-sequence : ll-model? string? steps? extra-files? -> (void)
;; given a language model and an expression and a sequence of steps, ;; given a language model and an expression and a sequence of steps,
;; check to see whether the stepper produces the desired steps ;; check to see whether the stepper produces the desired steps
@ -136,6 +138,7 @@
(unless (display-only-errors) (unless (display-only-errors)
(printf "testing string: ~v\n" exp-str)) (printf "testing string: ~v\n" exp-str))
(test-sequence/core render-settings expander-thunk expected-steps error-box) (test-sequence/core render-settings expander-thunk expected-steps error-box)
(close-input-port port)
(delete-file "stepper-test") (delete-file "stepper-test")
(for ([f (in-list extra-files)]) (for ([f (in-list extra-files)])
(delete-file (first f)))]))) (delete-file (first f)))])))
@ -150,7 +153,8 @@
[(struct ll-model (namespace-spec render-settings enable-testing?)) [(struct ll-model (namespace-spec render-settings enable-testing?))
(let ([filename "stepper-test"]) (let ([filename "stepper-test"])
(display-to-file exp-str filename #:exists 'truncate) (display-to-file exp-str filename #:exists 'truncate)
(let* ([port (open-input-file filename)] (set! port (open-input-file "stepper-test"))
(let* (#;[port (open-input-file filename)]
[module-id (gensym "stepper-module-name-")]) [module-id (gensym "stepper-module-name-")])
;; thunk this so that syntax errors happen within the error handlers: ;; thunk this so that syntax errors happen within the error handlers:
(lambda () (expand-teaching-program port read-syntax namespace-spec '() #f module-id enable-testing?))))]))) (lambda () (expand-teaching-program port read-syntax namespace-spec '() #f module-id enable-testing?))))])))