summaryrefslogtreecommitdiffstats
path: root/tests/018
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-05-03 07:07:14 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-05-03 07:07:14 -0700
commit49008cd459d87f7b38045bddf5a5bbd1c6f1a189 (patch)
treea1964c35294581d7f9a870d8832ed059f3c476cd /tests/018
parent8be2ee867659dc8b6c47d4fb6694aceaf10bfd7c (diff)
downloadtxr-49008cd459d87f7b38045bddf5a5bbd1c6f1a189.tar.gz
txr-49008cd459d87f7b38045bddf5a5bbd1c6f1a189.tar.bz2
txr-49008cd459d87f7b38045bddf5a5bbd1c6f1a189.zip
rel-path: bugfixes.
* share/txr/stdlib/copy-file.tl: When removing .. components, a dotdot must only cancel preceding non-dotdot. We must check not only that the out stack is not empty but that the top element isn't dotdot. Also, eliminate empty components, like the documentation says. Lastly, we must check for the impossible cases, when the from path uses .. components that are impossible to navigate backwards to form a relative path. * tests/018/rel-path.tl: Test cases added. * txr.1: Updated with additional descriptions, fixes and examples.
Diffstat (limited to 'tests/018')
-rw-r--r--tests/018/rel-path.tl7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/018/rel-path.tl b/tests/018/rel-path.tl
index 1afff796..cdcc7e4f 100644
--- a/tests/018/rel-path.tl
+++ b/tests/018/rel-path.tl
@@ -14,4 +14,9 @@
(rel-path "abc" "d/e/f/g/h") "../d/e/f/g/h"
(rel-path "abc" "d/e/../g/h") "../d/g/h"
(rel-path "d/e/../g/h" ".") "../../.."
- (rel-path "d/e/../g/h" "a/b") "../../../a/b")
+ (rel-path "d/e/../g/h" "a/b") "../../../a/b"
+ (rel-path "x" "../../../y") "../../../../y"
+ (rel-path "x///" "x") "."
+ (rel-path "x" "x///") "."
+ (rel-path "///x" "/x") "."
+ (rel-path "../../x" "y") :error)