summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--stdlib/path-test.tl8
-rw-r--r--tests/018/rel-path.tl5
2 files changed, 8 insertions, 5 deletions
diff --git a/stdlib/path-test.tl b/stdlib/path-test.tl
index 491f63af..b7e75018 100644
--- a/stdlib/path-test.tl
+++ b/stdlib/path-test.tl
@@ -301,9 +301,9 @@
(let ((vol (car more)))
(cond
((nequal "" vol)
- (set (car comp) "")
- (set (cdr comp) (cdr more))
- vol)
+ (set (car comp) "")
+ (set (cdr comp) (cdr more))
+ vol)
(t :abs))))
((and (m^ #/[A-Za-z0-9]+:/ head) head)
(set (car comp) next)
@@ -311,7 +311,7 @@
(if (and (equal "" next) more)
^(:abs . ,head)
^(:rel . ,head)))))
- (if (equal head "") :abs))))
+ (if (and (equal head "") (cdr comp)) :abs))))
(defun rel-path (from to)
(let* ((fspl (path-split from))
diff --git a/tests/018/rel-path.tl b/tests/018/rel-path.tl
index cdcc7e4f..11651c17 100644
--- a/tests/018/rel-path.tl
+++ b/tests/018/rel-path.tl
@@ -19,4 +19,7 @@
(rel-path "x///" "x") "."
(rel-path "x" "x///") "."
(rel-path "///x" "/x") "."
- (rel-path "../../x" "y") :error)
+ (rel-path "../../x" "y") :error
+ (rel-path "" "") "."
+ (rel-path "a" "") ".."
+ (rel-path "" "a") "a")