write and read files in 'text' mode; Closes PR12120
This commit is contained in:
parent
41ae2b57b6
commit
accb677f0e
|
@ -1,4 +1,4 @@
|
|||
#lang scheme
|
||||
#lang racket
|
||||
|
||||
(require (for-syntax syntax/parse)
|
||||
srfi/13 htdp/error
|
||||
|
@ -109,7 +109,9 @@
|
|||
(dynamic-wind
|
||||
(lambda ()
|
||||
(with-output-to-file t
|
||||
(lambda () (for-each displayln los)) #:exists 'replace))
|
||||
(lambda () (for-each displayln los))
|
||||
#:mode 'text
|
||||
#:exists 'replace))
|
||||
(lambda ()
|
||||
(reader (path->string t)))
|
||||
(lambda ()
|
||||
|
@ -142,6 +144,7 @@
|
|||
;; read a file as a list of X where process-accu is applied to accu when eof
|
||||
(define (read-chunks f read-chunk process-accu)
|
||||
(with-input-from-file f
|
||||
#:mode 'text
|
||||
(lambda ()
|
||||
(let loop ([accu '()])
|
||||
(define nxt (read-chunk))
|
||||
|
|
|
@ -48,10 +48,10 @@ eos
|
|||
(string #\newline)
|
||||
(second test2-as-list))))
|
||||
|
||||
;(write-file file test1)
|
||||
(write-file file test1)
|
||||
(check-true (string=? (simulate-file read-file test1) test1) "read-file 1")
|
||||
|
||||
;(write-file file test2)
|
||||
(write-file file test2)
|
||||
(check-true (string=? (simulate-file read-file test2) test2) "read-file 2")
|
||||
|
||||
(write-file file test1)
|
||||
|
|
Loading…
Reference in New Issue
Block a user