summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-03-28 22:42:24 +0100
committerLudovic Courtès <ludo@gnu.org>2013-03-28 22:42:31 +0100
commit2a7d614cc0bc902895cdb873590e8a24cf680368 (patch)
tree1bc970ce1f771e1d414aadc18f431da2b8a7b4ff
parent8d6e3dd83a09f35a18774baa696ba443aa379cbb (diff)
tests: Fix file name canonicalization tests for when $srcdir contains symlinks.
* test-suite/tests/ports.test ("%file-port-name-canonicalization"): Use `pass-if-equal' instead of `pass-if'. ["relative canonicalization from ice-9"]: Throw to `unresolved' when %LOAD-PATH is not canonical. ["absolute canonicalization from ice-9"]: Canonicalize the result.
-rw-r--r--test-suite/tests/ports.test50
1 files changed, 26 insertions, 24 deletions
diff --git a/test-suite/tests/ports.test b/test-suite/tests/ports.test
index 372993032..886ab2418 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 Free Software Foundation, Inc.
+;;;; 2011, 2012, 2013 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
@@ -1162,33 +1162,35 @@
(with-test-prefix "%file-port-name-canonicalization"
- (pass-if "absolute file name & empty %load-path entry"
+ (pass-if-equal "absolute file name & empty %load-path entry" "/dev/null"
;; In Guile 2.0.5 and earlier, this would return "dev/null" instead
;; of "/dev/null". See
;; <http://lists.gnu.org/archive/html/guile-devel/2012-05/msg00059.html>
;; for a discussion.
- (equal? "/dev/null"
- (with-load-path (cons "" (delete "/" %load-path))
- (with-fluids ((%file-port-name-canonicalization 'relative))
- (port-filename (open-input-file "/dev/null"))))))
-
- (pass-if "relative canonicalization with /"
- (equal? "dev/null"
- (with-load-path (cons "/" %load-path)
- (with-fluids ((%file-port-name-canonicalization 'relative))
- (port-filename (open-input-file "/dev/null"))))))
-
- (pass-if "relative canonicalization from ice-9"
- (equal? "ice-9/q.scm"
- (with-fluids ((%file-port-name-canonicalization 'relative))
- (port-filename
- (open-input-file (%search-load-path "ice-9/q.scm"))))))
-
- (pass-if "absolute canonicalization from ice-9"
- (equal? (string-append (assoc-ref %guile-build-info 'top_srcdir)
- "/module/ice-9/q.scm")
- (with-fluids ((%file-port-name-canonicalization 'absolute))
- (port-filename (open-input-file (%search-load-path "ice-9/q.scm")))))))
+ (with-load-path (cons "" (delete "/" %load-path))
+ (with-fluids ((%file-port-name-canonicalization 'relative))
+ (port-filename (open-input-file "/dev/null")))))
+
+ (pass-if-equal "relative canonicalization with /" "dev/null"
+ (with-load-path (cons "/" %load-path)
+ (with-fluids ((%file-port-name-canonicalization 'relative))
+ (port-filename (open-input-file "/dev/null")))))
+
+ (pass-if-equal "relative canonicalization from ice-9" "ice-9/q.scm"
+ ;; If an entry in %LOAD-PATH is not canonical, then
+ ;; `scm_i_relativize_path' is unable to do its job.
+ (if (equal? (map canonicalize-path %load-path) %load-path)
+ (with-fluids ((%file-port-name-canonicalization 'relative))
+ (port-filename
+ (open-input-file (%search-load-path "ice-9/q.scm"))))
+ (throw 'unresolved)))
+
+ (pass-if-equal "absolute canonicalization from ice-9"
+ (canonicalize-path
+ (string-append (assoc-ref %guile-build-info 'top_srcdir)
+ "/module/ice-9/q.scm"))
+ (with-fluids ((%file-port-name-canonicalization 'absolute))
+ (port-filename (open-input-file (%search-load-path "ice-9/q.scm"))))))
(delete-file (test-file))