summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorRichard Sent <richard@freakingpenguin.com>2024-06-02 15:44:27 -0400
committerLudovic Courtès <ludo@gnu.org>2024-09-04 19:17:00 +0200
commitf3ea876895f19b7460c2d3647578905cc80e0cfe (patch)
tree0369eca900fc119ea57b81ffe0a07a335e099dd5 /tests
parent8da7f4a1103abc2abeef1ba149e6beb8b7966ab2 (diff)
downloadguix-f3ea876895f19b7460c2d3647578905cc80e0cfe.tar.gz
gexp: Add ‘assume-source-relative-file-name’.
* guix/gexp.scm (assume-source-relative-file-name): New macro.
(local-file): Use assume-source-relative-file-name to look up a non-literal
file relative to the current source directory.
* doc/guix.texi (G-expressions): Document it.
* tests/gexp.scm ("local-file, non-literal source relative file name"):
New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Change-Id: I18573c8c7a6c87e8351b34412f9d26bb23b068b4
Diffstat (limited to 'tests')
-rw-r--r--tests/gexp.scm6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index b35bfc920f..ab99e19daa 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -251,6 +251,12 @@
       (let ((file (local-file (string-copy "../base32.scm"))))
         (local-file-absolute-file-name file)))))
 
+(test-equal "local-file, non-literal source relative file name"
+  (current-filename)
+  (let ((file (local-file (assume-source-relative-file-name
+                           (string-append "gexp" ".scm")))))
+    (local-file-absolute-file-name file)))
+
 (test-assert "local-file, relative file name, within gexp"
   (let* ((file     (search-path %load-path "guix/base32.scm"))
          (interned (add-to-store %store "base32.scm" #f "sha256" file)))