|
10 | 10 | p = {{"not-exist", false}, ... |
11 | 11 | {mfilename("fullpath") + ".m", false}, ... |
12 | 12 | {"", false}}; |
13 | | -cs_fun = {'native', 'sys', 'dotnet', 'python'} |
| 13 | +cs_backend = {'native', 'sys', 'dotnet', 'python'} |
14 | 14 | Pre = {'', "", tempname()} |
15 | | -rs_fun = {'native', 'sys', 'dotnet', 'java', 'python'} |
| 15 | +ir_backend = {'native', 'sys', 'dotnet', 'java', 'python'} |
16 | 16 | end |
17 | 17 |
|
18 | 18 | methods(TestClassSetup) |
@@ -44,48 +44,57 @@ function setup_symlink(tc) |
44 | 44 |
|
45 | 45 | methods (Test, TestTags=["impure", "symlink"]) |
46 | 46 |
|
47 | | -function test_is_symlink(tc, p, rs_fun) |
48 | | -tc.assertNotEmpty(which("stdlib." + rs_fun + ".is_symlink")) |
| 47 | +function test_is_symlink(tc, p, ir_backend) |
| 48 | +tc.assertNotEmpty(which("stdlib." + ir_backend + ".is_symlink")) |
49 | 49 | try |
50 | | - tc.verifyTrue(stdlib.is_symlink(tc.link, rs_fun), "failed to detect own link") |
51 | | - tc.verifyEqual(stdlib.is_symlink(p{1}, rs_fun), p{2}, p{1}) |
| 50 | + tc.verifyTrue(stdlib.is_symlink(tc.link, ir_backend), "failed to detect own link") |
| 51 | + tc.verifyEqual(stdlib.is_symlink(p{1}, ir_backend), p{2}, p{1}) |
| 52 | +catch e |
| 53 | + tc.verifyEqual(e.identifier, 'stdlib:hbackend:NameError', e.message) |
| 54 | +end |
| 55 | +end |
| 56 | + |
| 57 | +function test_is_symlink_array(tc, ir_backend) |
| 58 | +try |
| 59 | + r = stdlib.is_symlink([tc.link, mfilename() + ".m"], ir_backend); |
| 60 | + tc.verifyEqual(r, [true, false], "failed to detect own link") |
52 | 61 | catch e |
53 | 62 | tc.verifyEqual(e.identifier, 'stdlib:hbackend:NameError', e.message) |
54 | 63 | end |
55 | 64 | end |
56 | 65 |
|
57 | 66 |
|
58 | | -function test_read_symlink_empty(tc, Pre, rs_fun) |
| 67 | +function test_read_symlink_empty(tc, Pre, ir_backend) |
59 | 68 | try |
60 | | - tc.verifyEmpty(stdlib.read_symlink(Pre, rs_fun)) |
| 69 | + tc.verifyEmpty(stdlib.read_symlink(Pre, ir_backend)) |
61 | 70 | catch e |
62 | 71 | tc.verifyEqual(e.identifier, 'stdlib:hbackend:NameError', e.message) |
63 | 72 | end |
64 | 73 | end |
65 | 74 |
|
66 | 75 |
|
67 | | -function test_read_symlink(tc, rs_fun) |
68 | | -tc.assertNotEmpty(which("stdlib." + rs_fun + ".read_symlink")) |
| 76 | +function test_read_symlink(tc, ir_backend) |
| 77 | +tc.assertNotEmpty(which("stdlib." + ir_backend + ".read_symlink")) |
69 | 78 | try |
70 | | - tc.verifyEqual(stdlib.read_symlink(tc.link, rs_fun), string(tc.target)) |
| 79 | + tc.verifyEqual(stdlib.read_symlink(tc.link, ir_backend), string(tc.target)) |
71 | 80 | catch e |
72 | 81 | tc.verifyEqual(e.identifier, 'stdlib:hbackend:NameError', e.message) |
73 | 82 | end |
74 | 83 | end |
75 | 84 |
|
76 | 85 |
|
77 | | -function test_create_symlink(tc, cs_fun) |
78 | | -tc.assumeNotEmpty(which("stdlib." + cs_fun + ".create_symlink")) |
| 86 | +function test_create_symlink(tc, cs_backend) |
| 87 | +tc.assumeNotEmpty(which("stdlib." + cs_backend + ".create_symlink")) |
79 | 88 | tc.applyFixture(matlab.unittest.fixtures.SuppressedWarningsFixture(["MATLAB:io:filesystem:symlink:TargetNotFound","MATLAB:io:filesystem:symlink:FileExists"])) |
80 | 89 |
|
81 | 90 | ano = tc.td + "/another.lnk"; |
82 | 91 |
|
83 | 92 | h = @stdlib.create_symlink; |
84 | 93 |
|
85 | 94 | try |
86 | | - tc.verifyFalse(h('', tempname(), cs_fun)) |
87 | | - tc.verifyFalse(h(tc.target, tc.link, cs_fun), "should fail for existing symlink") |
88 | | - tc.verifyTrue(h(tc.target, ano, cs_fun)) |
| 95 | + tc.verifyFalse(h('', tempname(), cs_backend)) |
| 96 | + tc.verifyFalse(h(tc.target, tc.link, cs_backend), "should fail for existing symlink") |
| 97 | + tc.verifyTrue(h(tc.target, ano, cs_backend)) |
89 | 98 | catch e |
90 | 99 | tc.verifyEqual(e.identifier, 'stdlib:hbackend:NameError', e.message) |
91 | 100 | return |
|
0 commit comments