summaryrefslogtreecommitdiffstats
path: root/tests/018/path.tl
blob: a00b946557565cfb484981abaab1ad5a78fe0c61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
(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 ".") nil
  (short-suffix "a.") ""
  (short-suffix "a.b.") ""
  (short-suffix ".c") nil
  (short-suffix "a.c") "c"
  (short-suffix "a.b.c") "c"
  (short-suffix "foo.txt.gz") "gz"
  (short-suffix "txt.gz") "gz"
  (short-suffix ".gz") nil)

(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 ".") nil
  (long-suffix "a.") ""
  (long-suffix "a.b.") "b."
  (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") 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 "/.") 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") 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)

(mtest
  (long-suffix "/") nil
  (long-suffix "a/") nil
  (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") 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)