diff --git a/collects/htdp/convert.rkt b/collects/htdp/convert.rkt index e5e29808cb..9c58db1d62 100644 --- a/collects/htdp/convert.rkt +++ b/collects/htdp/convert.rkt @@ -237,12 +237,12 @@ ;; convert-file : str (num -> num) str -> void ;; to read a number from file in, to convert it with f, and to write it to out (define (convert-file in f out) - (check-arg 'convert-file (string? in) "string" "first" in) + (check-arg 'convert-file (path-string? in) "string" "first" in) (check-arg 'convert-file (file-exists? in) (format "name of existing file in ~a" (current-directory)) "first" in) (check-proc 'convert-file f 1 "convert-file" "one argument") - (check-arg 'convert-file (string? out) "string" "third" out) + (check-arg 'convert-file (path-string? out) "string" "third" out) ;; [ -> Void] -> Void ;; perform the actual conversion on the file after optionally reading a prelude (define (convert-file prefix) diff --git a/collects/htdp/tests/convert-drracket-error.rkt b/collects/htdp/tests/convert-drracket-error.rkt index e9602818e7..5a7aa95fd7 100644 --- a/collects/htdp/tests/convert-drracket-error.rkt +++ b/collects/htdp/tests/convert-drracket-error.rkt @@ -1,12 +1,15 @@ #lang racket +(require racket/runtime-path + htdp/convert) -(require htdp/convert) +(define-runtime-path non-error-pth "convert-drracket-non-error.txt") +(define-runtime-path error-pth "convert-drracket-error.txt") (define (Fahrenheit->Celsius x) (* (/ 100 180) (- x 32))) -(convert-file "convert-drracket-non-error.txt" Fahrenheit->Celsius "out.dat") +(convert-file non-error-pth Fahrenheit->Celsius "out.dat") (with-handlers ((exn:fail:read? void)) "The input file contains a bad header. The next line should raise an exn." - (convert-file "convert-drracket-error.txt" Fahrenheit->Celsius "out.dat") + (convert-file error-pth Fahrenheit->Celsius "out.dat") (raise `(test "this test should have failed but didn't")))