Make temporary file in coding.test work on MS-Windows.
authorEli Zaretskii <eliz@gnu.org>
Wed, 13 Aug 2014 15:41:15 +0000 (18:41 +0300)
committerEli Zaretskii <eliz@gnu.org>
Wed, 13 Aug 2014 15:41:15 +0000 (18:41 +0300)
* test-suite/tests/coding.test (with-temp-file): Instead of
  hard-coding "/tmp" as the temporary directory, use $TMPDIR or
  $TEMP from the environment, and fall back on "/tmp" if none of
  those 2 is defined.

test-suite/tests/coding.test

index b57ef7d..5f643f8 100644 (file)
   #:use-module (test-suite lib))
 
 (define (with-temp-file proc)
   #:use-module (test-suite lib))
 
 (define (with-temp-file proc)
-  (let* ((name (string-copy "/tmp/coding-test.XXXXXX"))
+  (let* ((tmpdir (or (getenv "TMPDIR")
+                     (getenv "TEMP")
+                     "/tmp"))
+         (name (string-append tmpdir "/coding-test.XXXXXX"))
          (port (mkstemp! name)))
     (let ((res (with-throw-handler
                 #t
          (port (mkstemp! name)))
     (let ((res (with-throw-handler
                 #t