1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

encoding test tries to delete a file that is not closed

On Windows, deleting a file on an open port does not succeed

* test-suite/tests/ports.test ("%default-port-encoding, wrong encoding"):
  ensure port is closed before deleting
This commit is contained in:
Michael Gran 2020-12-23 09:00:02 -08:00
parent 1a6eaba436
commit fe505e1a2a

View file

@ -2,7 +2,7 @@
;;;; Jim Blandy <jimb@red-bean.com> --- May 1999
;;;;
;;;; Copyright (C) 1999, 2001, 2004, 2006, 2007, 2009, 2010,
;;;; 2011, 2012, 2013, 2014, 2015, 2017, 2019, 2020 Free Software Foundation, Inc.
;;;; 2011, 2012, 2013, 2014, 2015, 2017, 2019, 2020, 2021 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@ -1318,14 +1318,17 @@
(set-port-encoding! p "does-not-exist")
(read p)))
(let ((filename (test-file)))
(with-output-to-file filename (lambda () (write 'test)))
(let* ((filename (test-file))
(port (open-output-file filename)))
(write 'test port)
(close-port port)
(pass-if-exception "%default-port-encoding, wrong encoding"
exception:miscellaneous-error
(read (with-fluids ((%default-port-encoding "does-not-exist"))
(open-input-file filename))))
(with-fluids ((%default-port-encoding "does-not-exist"))
(set! port (open-input-file filename))
(read port)))
(false-if-exception (close-port port))
(delete-file filename)))
;;;