|
17 | 17 | sub_is_subdir |
18 | 18 | ref_is_subdir |
19 | 19 |
|
20 | | -in_parent = {"", ".", "..", "../..", "a/b", "a/b/", "ab/.parent", "ab/.parent.txt", "a/b/../.parent.txt"} |
21 | | -ref_parent = {".", ".", ".", "..", "a", "a", "ab", "ab", "a/b/.."} |
| 20 | +in_parent |
| 21 | +ref_parent |
| 22 | + |
| 23 | +in_join = {"", "a", "", "a/b/", "/", "", "a", "a//", "a/b/../", "a/b", "a/b", "ab/cd"} |
| 24 | +other_join = {"", "", "b", "c/", "", "/", "b//", "b//", "c/d/../", "..", "c/d", "/ef"} |
| 25 | +ref_join = {"", "a", "b", "a/b/c", "/", "/", "a/b", "a/b", "a/c", "a", "a/b/c/d", "/ef"} |
22 | 26 |
|
23 | 27 | in_suffix = {"", "/foo/bar/baz", "/foo/bar/baz/", "foo/bar/baz.txt", "foo/bar/baz.txt.gz", ".stat", ".stat.txt"} |
24 | 28 | ref_suffix = {"", "", "", ".txt", ".gz", ".stat", ".txt"} |
|
37 | 41 | end |
38 | 42 |
|
39 | 43 | methods (TestParameterDefinition, Static) |
40 | | -function [base_relative_to, other_relative_to, ref_relative_to, ref_proximate_to, in_root, ref_root] = init_relative_to(classToTest) %#ok<INUSD> |
| 44 | +function [base_relative_to, other_relative_to, ref_relative_to, ref_proximate_to, in_root, ref_root, in_parent, ref_parent] = init_relative_to(classToTest) %#ok<INUSD> |
41 | 45 |
|
42 | 46 | in_root = {"", "a/b", "./a/b", "../a/b", "/etc", "c:/etc"}; |
43 | 47 | ref_root = {"", "", "", "", "/", ""}; |
44 | 48 |
|
| 49 | +in_parent = {"", ".", "..", "../..", "a/", "a/b", "a/b/", "ab/.parent", "ab/.parent.txt", "a/b/../.parent.txt", "a/////b////c", "c:/", "c:\", "c:/a/b", "c:\a/b"}; |
| 50 | +ref_parent = {".", ".", ".", "..", ".", "a", "a", "ab", "ab", "a/b/..", "a/b", ".", ".", "c:/a", "c:\a"}; |
| 51 | + |
45 | 52 | if ispc |
46 | 53 |
|
47 | 54 | base_relative_to = {'', 'Hello', 'Hello', ... |
|
55 | 62 | ref_proximate_to = ref_relative_to; |
56 | 63 | ref_proximate_to{end} = other_relative_to{end}; |
57 | 64 |
|
| 65 | +ref_parent{12} = "c:/"; |
| 66 | +ref_parent{13} = "c:/"; |
| 67 | +ref_parent{14} = "c:/a"; |
| 68 | +ref_parent{15} = "c:/a"; |
| 69 | + |
58 | 70 | ref_root{5} = ""; |
59 | 71 | ref_root{6} = "c:/"; |
60 | 72 |
|
@@ -158,6 +170,11 @@ function test_posix(tc) |
158 | 170 | end |
159 | 171 |
|
160 | 172 |
|
| 173 | +function test_join(tc, in_join, other_join, ref_join) |
| 174 | +tc.verifyEqual(stdlib.join(in_join, other_join), ref_join) |
| 175 | +end |
| 176 | + |
| 177 | + |
161 | 178 | function test_filename(tc, in_filename, ref_filename) |
162 | 179 | tc.verifyEqual(stdlib.filename(in_filename), string(ref_filename)) |
163 | 180 | end |
|
0 commit comments