mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
union: Add 'relative-file-name'.
* guix/build/union.scm (%not-slash): New variable. (relative-file-name): New procedure. * tests/union.scm (test-relative-file-name): New macro and tests.
This commit is contained in:
parent
8584965b79
commit
dac1c97d13
3 changed files with 59 additions and 2 deletions
|
@ -184,4 +184,22 @@
|
|||
(file-is-directory? "bin")
|
||||
(eq? 'symlink (stat:type (lstat "bin/guile"))))))))
|
||||
|
||||
(letrec-syntax ((test-relative-file-name
|
||||
(syntax-rules (=>)
|
||||
((_ (reference file => expected) rest ...)
|
||||
(begin
|
||||
(test-equal (string-append "relative-file-name "
|
||||
reference " " file)
|
||||
expected
|
||||
(relative-file-name reference file))
|
||||
(test-relative-file-name rest ...)))
|
||||
((_)
|
||||
#t))))
|
||||
(test-relative-file-name
|
||||
("/a/b" "/a/c/d" => "../c/d")
|
||||
("/a/b" "/a/b" => "")
|
||||
("/a/b" "/a" => "..")
|
||||
("/a/b" "/a/b/c/d" => "c/d")
|
||||
("/a/b/c" "/a/d/e/f" => "../../d/e/f")))
|
||||
|
||||
(test-end)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue