|
10 | 10 | p = {{"not-exist", false}, ... |
11 | 11 | {mfilename("fullpath") + ".m", false}, ... |
12 | 12 | {"", false}}; |
13 | | -create_symlink_fun = {@stdlib.create_symlink, @stdlib.sys.create_symlink, @stdlib.dotnet.create_symlink, @stdlib.python.create_symlink} |
| 13 | +cs_fun = {'native', 'sys', 'dotnet', 'python'} |
14 | 14 | Pre = {'', "", tempname()} |
15 | 15 | rs_fun = {'native', 'sys', 'dotnet', 'java', 'python'} |
16 | 16 | end |
@@ -74,16 +74,22 @@ function test_read_symlink(tc, rs_fun) |
74 | 74 | end |
75 | 75 |
|
76 | 76 |
|
77 | | -function test_create_symlink(tc, create_symlink_fun) |
78 | | -is_capable(tc, create_symlink_fun) |
79 | | - |
| 77 | +function test_create_symlink(tc, cs_fun) |
| 78 | +tc.assumeNotEmpty(which("stdlib." + cs_fun + ".create_symlink")) |
80 | 79 | tc.applyFixture(matlab.unittest.fixtures.SuppressedWarningsFixture(["MATLAB:io:filesystem:symlink:TargetNotFound","MATLAB:io:filesystem:symlink:FileExists"])) |
81 | 80 |
|
82 | | -tc.verifyFalse(create_symlink_fun('', tempname())) |
83 | | -tc.verifyFalse(create_symlink_fun(tc.target, tc.link), "should fail for existing symlink") |
84 | | - |
85 | 81 | ano = tc.td + "/another.lnk"; |
86 | | -tc.verifyTrue(create_symlink_fun(tc.target, ano)) |
| 82 | + |
| 83 | +h = @stdilb.create_symlink; |
| 84 | + |
| 85 | +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)) |
| 89 | +catch e |
| 90 | + tc.verifyEqual(e.identifier, 'stdlib:choose_method:NameError', e.message) |
| 91 | + return |
| 92 | +end |
87 | 93 | tc.verifyTrue(stdlib.is_symlink(ano)) |
88 | 94 | end |
89 | 95 |
|
|
0 commit comments