guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 01/13: encoding test tries to delete a file that is not


From: Mike Gran
Subject: [Guile-commits] 01/13: encoding test tries to delete a file that is not closed
Date: Thu, 21 Jan 2021 19:06:14 -0500 (EST)

mike121 pushed a commit to branch master
in repository guile.

commit fe505e1a2aa8f71ab68cac878840aff9f3d2ede6
Author: Michael Gran <spk121@yahoo.com>
AuthorDate: Wed Dec 23 09:00:02 2020 -0800

    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
---
 test-suite/tests/ports.test | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/test-suite/tests/ports.test b/test-suite/tests/ports.test
index 31fb2b0..bd7a927 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)))
 
 ;;;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]