mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
Fix deletion of ports.test test file on MS-Windows.
* test-suite/tests/ports.test ("fdes->port", "seek") ("truncate-file"): Close every file and port we open, to avoid failure to delete the test file on MS-Windows when the test is completed.
This commit is contained in:
parent
c7161ee334
commit
0d77e062dc
1 changed files with 17 additions and 8 deletions
|
@ -1270,9 +1270,10 @@
|
||||||
(with-test-prefix
|
(with-test-prefix
|
||||||
"fdes->port"
|
"fdes->port"
|
||||||
(pass-if "fdes->ports finds port"
|
(pass-if "fdes->ports finds port"
|
||||||
(let ((port (open-file (test-file) "w")))
|
(let* ((port (open-file (test-file) "w"))
|
||||||
|
(res (not (not (memq port (fdes->ports (port->fdes port)))))))
|
||||||
(not (not (memq port (fdes->ports (port->fdes port))))))))
|
(close-port port)
|
||||||
|
res)))
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; seek
|
;;; seek
|
||||||
|
@ -1289,7 +1290,9 @@
|
||||||
(let ((port (open-file (test-file) "r")))
|
(let ((port (open-file (test-file) "r")))
|
||||||
(read-char port)
|
(read-char port)
|
||||||
(seek port 2 SEEK_CUR)
|
(seek port 2 SEEK_CUR)
|
||||||
(eqv? #\d (read-char port))))
|
(let ((res (eqv? #\d (read-char port))))
|
||||||
|
(close-port port)
|
||||||
|
res)))
|
||||||
|
|
||||||
(pass-if "SEEK_SET"
|
(pass-if "SEEK_SET"
|
||||||
(call-with-output-file (test-file)
|
(call-with-output-file (test-file)
|
||||||
|
@ -1298,7 +1301,9 @@
|
||||||
(let ((port (open-file (test-file) "r")))
|
(let ((port (open-file (test-file) "r")))
|
||||||
(read-char port)
|
(read-char port)
|
||||||
(seek port 3 SEEK_SET)
|
(seek port 3 SEEK_SET)
|
||||||
(eqv? #\d (read-char port))))
|
(let ((res (eqv? #\d (read-char port))))
|
||||||
|
(close-port port)
|
||||||
|
res)))
|
||||||
|
|
||||||
(pass-if "SEEK_END"
|
(pass-if "SEEK_END"
|
||||||
(call-with-output-file (test-file)
|
(call-with-output-file (test-file)
|
||||||
|
@ -1307,7 +1312,9 @@
|
||||||
(let ((port (open-file (test-file) "r")))
|
(let ((port (open-file (test-file) "r")))
|
||||||
(read-char port)
|
(read-char port)
|
||||||
(seek port -2 SEEK_END)
|
(seek port -2 SEEK_END)
|
||||||
(eqv? #\d (read-char port))))))
|
(let ((res (eqv? #\d (read-char port))))
|
||||||
|
(close-port port)
|
||||||
|
res)))))
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; truncate-file
|
;;; truncate-file
|
||||||
|
@ -1370,7 +1377,8 @@
|
||||||
(lambda (port)
|
(lambda (port)
|
||||||
(display "hello" port)))
|
(display "hello" port)))
|
||||||
(let ((port (open-file (test-file) "r+")))
|
(let ((port (open-file (test-file) "r+")))
|
||||||
(truncate-file port 1))
|
(truncate-file port 1)
|
||||||
|
(close-port port))
|
||||||
(eqv? 1 (stat:size (stat (test-file)))))
|
(eqv? 1 (stat:size (stat (test-file)))))
|
||||||
|
|
||||||
(pass-if "shorten to current pos"
|
(pass-if "shorten to current pos"
|
||||||
|
@ -1379,7 +1387,8 @@
|
||||||
(display "hello" port)))
|
(display "hello" port)))
|
||||||
(let ((port (open-file (test-file) "r+")))
|
(let ((port (open-file (test-file) "r+")))
|
||||||
(read-char port)
|
(read-char port)
|
||||||
(truncate-file port))
|
(truncate-file port)
|
||||||
|
(close-port port))
|
||||||
(eqv? 1 (stat:size (stat (test-file)))))))
|
(eqv? 1 (stat:size (stat (test-file)))))))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue