New versions of the GPLand LGPL with the new address of the FSF.
[bpt/guile.git] / test-suite / tests / filesys.test
CommitLineData
5e996bd6
KR
1;;;; filesys.test --- test file system functions -*- scheme -*-
2;;;;
3;;;; Copyright (C) 2004 Free Software Foundation, Inc.
4;;;;
5;;;; This library is free software; you can redistribute it and/or
6;;;; modify it under the terms of the GNU Lesser General Public
7;;;; License as published by the Free Software Foundation; either
8;;;; version 2.1 of the License, or (at your option) any later version.
9;;;;
10;;;; This library is distributed in the hope that it will be useful,
11;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13;;;; Lesser General Public License for more details.
14;;;;
15;;;; You should have received a copy of the GNU Lesser General Public
16;;;; License along with this library; if not, write to the Free Software
17;;;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19(define-module (test-suite test-filesys)
20 #:use-module (test-suite lib))
21
22;;;
23;;; copy-file
24;;;
25
26(with-test-prefix "copy-file"
27
28 ;; return next prospective file descriptor number
29 (define (next-fd)
30 (let ((fd (dup 0)))
31 (close fd)
32 fd))
33
34 ;; in guile 1.6.4 and earlier, copy-file didn't close the input fd when
35 ;; the output could not be opened
36 (pass-if "fd leak when dest unwritable"
37 (let ((old-next (next-fd)))
38 (false-if-exception (copy-file "/dev/null" "no/such/dir/foo"))
39 (= old-next (next-fd)))))