summaryrefslogtreecommitdiffstats
path: root/tests/018
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-06-26 08:30:42 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-06-26 08:30:42 -0700
commit84fb60917ce14c80d1382545276acd436954290e (patch)
tree22fe873c5fce107ee65bb83e1b08526689ba01a3 /tests/018
parent1002db49685b0fdf87e7ad8532840bf93d3bc2f9 (diff)
downloadtxr-84fb60917ce14c80d1382545276acd436954290e.tar.gz
txr-84fb60917ce14c80d1382545276acd436954290e.tar.bz2
txr-84fb60917ce14c80d1382545276acd436954290e.zip
suffix functions: leading dot is not delimiter
* stream.c (short_suffix, long_suffix): Do not treat the starting dot of the last componet as a suffix delimiter. * tests/018/path.tl: Test cases edited to reflect requirements change; new tests added. * txr.1: Updated.
Diffstat (limited to 'tests/018')
-rw-r--r--tests/018/path.tl36
1 files changed, 23 insertions, 13 deletions
diff --git a/tests/018/path.tl b/tests/018/path.tl
index 3dcb5eb3..a00b9465 100644
--- a/tests/018/path.tl
+++ b/tests/018/path.tl
@@ -7,14 +7,15 @@
(short-suffix "" 0) 0
(short-suffix "a") nil
(short-suffix "a" 0) 0
- (short-suffix ".") ""
+ (short-suffix ".") nil
(short-suffix "a.") ""
(short-suffix "a.b.") ""
- (short-suffix ".c") "c"
+ (short-suffix ".c") nil
(short-suffix "a.c") "c"
(short-suffix "a.b.c") "c"
(short-suffix "foo.txt.gz") "gz"
- (short-suffix ".gz") "gz")
+ (short-suffix "txt.gz") "gz"
+ (short-suffix ".gz") nil)
(mtest
(long-suffix 42) :error
@@ -23,24 +24,29 @@
(long-suffix "" 0) 0
(long-suffix "a") nil
(long-suffix "a" 0) 0
- (long-suffix ".") ""
+ (long-suffix ".") nil
(long-suffix "a.") ""
(long-suffix "a.b.") "b."
- (long-suffix ".c") "c"
+ (long-suffix ".c") nil
(long-suffix "a.c") "c"
(long-suffix "a.b.c") "b.c"
(long-suffix "foo.txt.gz") "txt.gz"
- (long-suffix ".gz") "gz"
- (long-suffix ".txt.gz") "txt.gz")
+ (long-suffix ".gz") nil
+ (long-suffix ".txt.gz") "gz"
+ (long-suffix "/.txt.gz") "gz"
+ (long-suffix "a/.txt.gz") "gz")
(mtest
(short-suffix "/") nil
(short-suffix "a/") nil
- (short-suffix ".a/") "a"
+ (short-suffix "/.") nil
+ (short-suffix "a/.") nil
+ (short-suffix ".a/") nil
(short-suffix ".a/b") nil
+ (short-suffix ".a/c.b") "b"
(short-suffix ".a/b/") nil
- (short-suffix ".a/b/.b") "b"
- (short-suffix ".a/b/.b/") "b"
+ (short-suffix ".a/b/.b") nil
+ (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)
@@ -48,13 +54,17 @@
(mtest
(long-suffix "/") nil
(long-suffix "a/") nil
- (long-suffix ".a/") "a"
+ (long-suffix "/.") nil
+ (long-suffix "a/.") nil
+ (long-suffix ".a/") nil
(long-suffix ".a/b") nil
(long-suffix ".a/b/") nil
- (long-suffix ".a/b/.b") "b"
- (long-suffix ".a/b/.b/") "b"
+ (long-suffix ".a/b/.b") nil
+ (long-suffix ".a/b/.b/") nil
(long-suffix ".a/b/c.b") "b"
(long-suffix ".a/b/c.b/") "b"
(long-suffix "a.b/c.d.e") "d.e"
(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)