diff options
author | Michael Gran <spk121@yahoo.com> | 2020-12-23 09:00:02 -0800 |
---|---|---|
committer | Michael Gran <spk121@yahoo.com> | 2021-01-21 14:32:53 -0800 |
commit | fe505e1a2aa8f71ab68cac878840aff9f3d2ede6 (patch) | |
tree | b4e25df3c629b1446f5b548b21648e0188ea1094 | |
parent | 1a6eaba4364bcc7897876166931df802ca7cbb9a (diff) | |
download | guile-fe505e1a2aa8f71ab68cac878840aff9f3d2ede6.tar.gz |
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
-rw-r--r-- | test-suite/tests/ports.test | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/test-suite/tests/ports.test b/test-suite/tests/ports.test index 31fb2b0a8..bd7a927f7 100644 --- a/test-suite/tests/ports.test +++ b/test-suite/tests/ports.test @@ -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))) ;;; |