move some test-generated files to temp dir

This commit is contained in:
Matthew Flatt 2014-06-16 14:44:38 +01:00
parent 1c9db0d07c
commit ad34e983f2
4 changed files with 17 additions and 14 deletions

View File

@ -7,9 +7,11 @@
(define (Fahrenheit->Celsius x) (* (/ 100 180) (- x 32))) (define (Fahrenheit->Celsius x) (* (/ 100 180) (- x 32)))
(convert-file non-error-pth Fahrenheit->Celsius "out.dat") (convert-file non-error-pth Fahrenheit->Celsius
(build-path (find-system-path 'temp-dir) "out.dat"))
(with-handlers ((exn:fail:read? void)) (with-handlers ((exn:fail:read? void))
"The input file contains a bad header. The next line should raise an exn." "The input file contains a bad header. The next line should raise an exn."
(convert-file error-pth Fahrenheit->Celsius "out.dat") (convert-file error-pth Fahrenheit->Celsius
(build-path (find-system-path 'temp-dir) "out.dat"))
(raise `(test "this test should have failed but didn't"))) (raise `(test "this test should have failed but didn't")))

View File

@ -18,8 +18,8 @@
(= (f2c -40) -40) (= (f2c -40) -40)
;; ---------------------------------------------------------------------------- ;; ----------------------------------------------------------------------------
(define IN "convert-in.dat") (define IN (build-path (find-system-path 'temp-dir) "convert-in.dat"))
(define OUT "convert-out.dat") (define OUT (build-path (find-system-path 'temp-dir) "convert-out.dat"))
(define (create-convert-in) (define (create-convert-in)
(printf "212 32\n-40\n")) (printf "212 32\n-40\n"))

View File

@ -10,10 +10,10 @@
(require srfi/42) (require srfi/42)
(define (my-open-output-file filename) (define (my-open-output-file filename)
(open-output-file filename 'replace 'text) ) (open-output-file (build-path (find-system-path 'temp-dir) filename) 'replace 'text) )
(define (my-call-with-input-file filename thunk) (define (my-call-with-input-file filename thunk)
(call-with-input-file filename thunk 'text) ) (call-with-input-file (build-path (find-system-path 'temp-dir) filename) thunk 'text) )
; examples.scm starts here ------------------------------------------------- ; examples.scm starts here -------------------------------------------------

View File

@ -1,6 +1,6 @@
#lang racket #lang racket
(define here (current-directory)) (define here (find-system-path 'temp-dir))
(define txt (build-path here "some.txt")) (define txt (build-path here "some.txt"))
(with-output-to-file txt (with-output-to-file txt
@ -11,7 +11,7 @@ Here is some text that looks at @this
END END
))) )))
(with-output-to-file "relative.rkt" (with-output-to-file (build-path here "relative.rkt")
#:exists 'replace #:exists 'replace
(lambda () (lambda ()
(display #<<END (display #<<END
@ -24,7 +24,7 @@ END
END END
))) )))
(with-output-to-file "absolute.rkt" (with-output-to-file (build-path here "absolute.rkt")
#:exists 'replace #:exists 'replace
(lambda () (lambda ()
(display #<<END (display #<<END
@ -45,11 +45,12 @@ END
))) )))
(require tests/eli-tester) (require tests/eli-tester)
(parameterize ([current-directory here])
(define rel (dynamic-require "relative.rkt" 'ans)) (define rel (dynamic-require "relative.rkt" 'ans))
(define abs (dynamic-require "absolute.rkt" 'ans)) (define abs (dynamic-require "absolute.rkt" 'ans))
(test (test
rel => abs rel => abs
rel => "Here is some text that looks at 5") rel => "Here is some text that looks at 5"))