From 08b4921e616a17ed8492527c6a89c08ccc33ea35 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 22 Jun 2021 06:53:56 -0700 Subject: New functions: long-suffix, short-suffix. * stream.c (short_suffix, long_suffix): New functions. (stream_init): short-suffix and long-suffix intrinsics registered. * stream.c (short_suffix, long_suffix): Declared. * tests/018/path.tl: New file. * txr.1: Documented. * share/txr/stdlib/doc-syms.tl: Updated. --- tests/018/path.tl | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/018/path.tl (limited to 'tests/018') diff --git a/tests/018/path.tl b/tests/018/path.tl new file mode 100644 index 00000000..be95d6c1 --- /dev/null +++ b/tests/018/path.tl @@ -0,0 +1,34 @@ +(load "../common") + +(mtest + (short-suffix 42) :error + (short-suffix #\a) :error + (short-suffix "") nil + (short-suffix "" 0) 0 + (short-suffix "a") nil + (short-suffix "a" 0) 0 + (short-suffix ".") "" + (short-suffix "a.") "" + (short-suffix "a.b.") "" + (short-suffix ".c") "c" + (short-suffix "a.c") "c" + (short-suffix "a.b.c") "c" + (short-suffix "foo.txt.gz") "gz" + (short-suffix ".gz") "gz") + +(mtest + (long-suffix 42) :error + (long-suffix #\a) :error + (long-suffix "") nil + (long-suffix "" 0) 0 + (long-suffix "a") nil + (long-suffix "a" 0) 0 + (long-suffix ".") "" + (long-suffix "a.") "" + (long-suffix "a.b.") "b." + (long-suffix ".c") "c" + (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") -- cgit v1.2.3