foreign-c-libraries/retropikzel/file-append/test.scm

13 lines
446 B
Scheme

(test-begin "file-append")
(define file-path "/tmp/file-append-test.txt")
(when (file-exists? file-path) (delete-file file-path))
(with-output-to-file file-path (lambda () (display "Hello")))
(test-equal "Hello" (with-input-from-file file-path (lambda () (read-line))))
(with-append-to-file file-path (lambda () (display " world")))
(test-equal "Hello world" (with-input-from-file file-path (lambda () (read-line))))
(test-end "file-append")