diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-07-03 16:06:17 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-07-03 16:06:17 -0700 |
commit | ccb998581d8ba1e2f8f9c56768d57e32c51777c5 (patch) | |
tree | f29a4d79f4dfa91880ca415c85229ea80e83d89b /tests/018 | |
parent | fc4d580aaa4bbd5908507596a429621e560b024b (diff) | |
download | txr-ccb998581d8ba1e2f8f9c56768d57e32c51777c5.tar.gz txr-ccb998581d8ba1e2f8f9c56768d57e32c51777c5.tar.bz2 txr-ccb998581d8ba1e2f8f9c56768d57e32c51777c5.zip |
suffix functions: ignore trailing slashes.
Another requirements tweak to short-suffix and long-suffix:
ignore one or more trailing slashes, instead of just one.
This harmonizes with base-name, which does same, that
requirement being copies from the POSIX basename utility.
* stream.c (short_suffix, long_suffix): If sl points to a
trailing slash which is the start of a suffix that consists of
nothing but trailing slashes, then we pretend it isn't there.
* tests/018/path.tl: Adjusted two existing test cases, and
added more.
* txr.1: Documented.
Diffstat (limited to 'tests/018')
-rw-r--r-- | tests/018/path.tl | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/018/path.tl b/tests/018/path.tl index 96298dfd..937d2d6e 100644 --- a/tests/018/path.tl +++ b/tests/018/path.tl @@ -49,7 +49,12 @@ (short-suffix ".a/b/.b/") nil (short-suffix ".a/b/c.b") ".b" (short-suffix ".a/b/c.b/") ".b" - (short-suffix ".a/b/c.b//") nil) + (short-suffix ".a/b/c.b//") ".b" + (short-suffix ".a/b/c.b///") ".b" + (short-suffix ".a/b/c.") "." + (short-suffix ".a/b/c./") "." + (short-suffix ".a/b/c.//") "." + (short-suffix ".a/b/c.///") ".") (mtest (long-suffix "/") nil @@ -67,7 +72,16 @@ (long-suffix "a.b/c.d.e/") ".d.e" (long-suffix "a.b/c.d.e/f") nil (long-suffix "a.b/c.d.e/f.g.h") ".g.h" - (long-suffix "a.b/c.d.e//") nil) + (long-suffix "a.b/c.d.e//") ".d.e" + (long-suffix "a.b/c.d.e///") ".d.e" + (long-suffix "a.b/c.d.") ".d." + (long-suffix "a.b/c.d./") ".d." + (long-suffix "a.b/c.d.//") ".d." + (long-suffix "a.b/c.d.///") ".d." + (long-suffix "a.b/c.") "." + (long-suffix "a.b/c./") "." + (long-suffix "a.b/c.//") "." + (long-suffix "a.b/c.///") ".") (mtest (base-name "") "" |