compatibility/collects/tests/racket/restart.rkt
Matthew Flatt a9c5ca02a2 move tests/mzscheme to tests/racket
original commit: 882b7dce0eaf92eab6fe45565ca6c1a09aa26027
2010-04-27 18:28:39 -06:00

37 lines
1.3 KiB
Racket

(load-relative "loadtest.rkt")
(require mzlib/restart)
(Section 'restart)
(test #t restart-mzscheme #("ignore-me") values #("") void)
(let ([test-in-out
(lambda (pre post in out err?)
(let ([err-out (open-output-string)])
(test (if out
(string-append "> " out "\n> ")
"")
'result
(let ([s (open-output-string)])
(parameterize ([current-input-port (open-input-string in)]
[current-output-port s]
[current-error-port err-out])
(restart-mzscheme pre values post void)
(get-output-string s))))
(test err? not (string=? "" (get-output-string err-out)))))])
(test-in-out #("-q" "ignore-me") #("-i") "(current-command-line-arguments)" "#()" #f)
(test-in-out #("-q") #("-i") "'Hello" "Hello" #f)
(test-in-out #("-q") #() "'Hello" "Hello" #f)
(test-in-out #("-q") #("-e" "1") "" #f #f)
(test-in-out #("-q") #("-i" "-e" "1") "'Hello" "Hello" #f)
(test-in-out #("-q") #("-e" "z") "" #f #t)
(test-in-out #("-q") #("-e" "car" "-i") "'Hello" "Hello" #f)
(test-in-out #("-q") #("-e" "car") "" #f #f)
(test-in-out #("-q") #("-l" "scheme/list" "-e" "car") "" #f #t)
)
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(report-errs)