summary refs log tree commit diff
path: root/tests/gexp.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-06-19 10:18:44 +0200
committerLudovic Courtès <ludo@gnu.org>2015-06-19 10:23:29 +0200
commit7833db1f30d78aea3b7cb042723c2bd7d00e64ad (patch)
tree6df17f0cbb8e8ffe693e92777ff78ae891a35014 /tests/gexp.scm
parent69792b285c98dc031d0464a08f84827e3f49c7f2 (diff)
downloadguix-7833db1f30d78aea3b7cb042723c2bd7d00e64ad.tar.gz
gexp: 'local-file' canonicalizes its file argument.
Reported by Alex Kost <alezost@gmail.com>
at <http://lists.gnu.org/archive/html/guix-devel/2015-06/msg00235.html>.

* guix/gexp.scm (local-file): Add call to 'canonicalize-path'.
* tests/gexp.scm ("one local file, symlink"): New test.
Diffstat (limited to 'tests/gexp.scm')
-rw-r--r--tests/gexp.scm19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index fee7d87d00..32031663f5 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -109,6 +109,25 @@
             (eq? x local)))
          (equal? `(display ,intd) (gexp->sexp* exp)))))
 
+(test-assert "one local file, symlink"
+  (let ((file (search-path %load-path "guix.scm"))
+        (link (tmpnam)))
+    (dynamic-wind
+      (const #t)
+      (lambda ()
+        (symlink (canonicalize-path file) link)
+        (let* ((local (local-file link "my-file" #:recursive? #f))
+               (exp   (gexp (display (ungexp local))))
+               (intd  (add-to-store %store "my-file" #f
+                                    "sha256" file)))
+          (and (gexp? exp)
+               (match (gexp-inputs exp)
+                 (((x "out"))
+                  (eq? x local)))
+               (equal? `(display ,intd) (gexp->sexp* exp)))))
+      (lambda ()
+        (false-if-exception (delete-file link))))))
+
 (test-assert "one plain file"
   (let* ((file     (plain-file "hi" "Hello, world!"))
          (exp      (gexp (display (ungexp file))))