summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-10-20 21:54:57 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-10-20 21:54:57 -0700
commit6ccf4e55ee05c998a0168cc58af728b046df5755 (patch)
treed7558bc061d6d7f51fc37fb02fec56b1a1040b11
parenta461bbf74d74d53f83acf53162bca32a203a05fc (diff)
downloadtxr-6ccf4e55ee05c998a0168cc58af728b046df5755.tar.gz
txr-6ccf4e55ee05c998a0168cc58af728b046df5755.tar.bz2
txr-6ccf4e55ee05c998a0168cc58af728b046df5755.zip
path-equal: enable and fix failing tests.
* stdlib/copy-file.tl (path-simplify): If the incoming path's first component is "", it is absolute; in that case swallow any components that go above. * tests/018/path-equal.tl: Uncomment two previously failing tests.
-rw-r--r--stdlib/copy-file.tl5
-rw-r--r--tests/018/path-equal.tl5
2 files changed, 5 insertions, 5 deletions
diff --git a/stdlib/copy-file.tl b/stdlib/copy-file.tl
index 5c87b10f..258192fc 100644
--- a/stdlib/copy-file.tl
+++ b/stdlib/copy-file.tl
@@ -214,10 +214,11 @@
(utimes s 0 nil 0 t))))
(defun path-simplify (comp)
- (let (out)
+ (let ((abs (equal (car comp) ""))
+ out)
(each ((c comp))
(casequal c
- (".." (if (and out (nequal (car out) ".."))
+ (".." (if (and (or out abs) (nequal (car out) ".."))
(pop out)
(push c out)))
(("." ""))
diff --git a/tests/018/path-equal.tl b/tests/018/path-equal.tl
index cf1fbb63..704c414a 100644
--- a/tests/018/path-equal.tl
+++ b/tests/018/path-equal.tl
@@ -13,6 +13,5 @@
(path-equal "a" "a/././.") t
(path-equal "a/." "a/././.") t
- ;;(path-equal "/.." "/") t
- ;;(path-equal "/../a" "/a/") t
- )
+ (path-equal "/.." "/") t
+ (path-equal "/../a" "/a/") t)