|
2 | 2 |
|
3 | 3 | properties (TestParameter) |
4 | 4 | Ps = {".", pwd(), "", tempname(), mfilename('fullpath') + ".m"} |
5 | | -sp_fun = {@stdlib.native.set_permissions, @stdlib.legacy.set_permissions} |
| 5 | +sp_fun = {'native', 'legacy'} |
6 | 6 | end |
7 | 7 |
|
8 | 8 | methods(TestClassSetup) |
@@ -56,18 +56,23 @@ function test_set_permissions_noread(tc) |
56 | 56 |
|
57 | 57 | function test_set_permissions_nowrite(tc, sp_fun) |
58 | 58 | import matlab.unittest.constraints.StartsWithSubstring |
59 | | -is_capable(tc, sp_fun) |
60 | 59 |
|
61 | 60 | tc.assumeFalse(isMATLABReleaseOlderThan('R2022a')) |
62 | 61 | td = tc.createTemporaryFolder(); |
63 | 62 |
|
64 | 63 | nw = fullfile(td, "no-write"); |
65 | 64 |
|
66 | 65 | tc.verifyTrue(stdlib.touch(nw)) |
67 | | -tc.verifyTrue(sp_fun(nw, 0, -1, 0)) |
68 | | -p = stdlib.get_permissions(nw); |
| 66 | +try |
| 67 | + tc.verifyTrue(stdlib.set_permissions(nw, 0, -1, 0, sp_fun)) |
| 68 | +catch e |
| 69 | + tc.verifyEqual(e.identifier, 'stdlib:choose_method:NameError') |
| 70 | + return |
| 71 | +end |
69 | 72 |
|
70 | | -if ~ispc() || ~contains(func2str(sp_fun), ".legacy.") |
| 73 | + |
| 74 | +p = stdlib.get_permissions(nw); |
| 75 | +if ~ispc() || sp_fun ~= "legacy" |
71 | 76 | tc.verifyThat(p, StartsWithSubstring("r-"), "no-write permission failed to set") |
72 | 77 | end |
73 | 78 |
|
|
0 commit comments