|
1 | 1 | classdef TestExists < matlab.unittest.TestCase |
2 | 2 |
|
3 | 3 | properties(TestParameter) |
4 | | -Ps = {{pwd(), true}, {mfilename("fullpath") + ".m", true}, ... |
5 | | - {"TestFileImpure.m", true}} |
| 4 | +Ps = { |
| 5 | +{pwd(), true}, ... |
| 6 | +{mfilename("fullpath") + ".m", true}, ... |
| 7 | +{fileparts(mfilename("fullpath")) + "/../Readme.md", true}, ... |
| 8 | +{tempname(), false} |
| 9 | +} |
6 | 10 | % on CI matlabroot can be writable! |
7 | 11 | end |
8 | 12 |
|
9 | 13 | methods (Test, TestTags="impure") |
10 | 14 |
|
11 | 15 | function test_exists(tc, Ps) |
12 | 16 | ok = stdlib.exists(Ps{1}); |
13 | | -tc.verifyEqual(ok, Ps{2}) |
| 17 | +tc.verifyEqual(ok, Ps{2}, Ps{1}) |
14 | 18 | end |
15 | 19 |
|
16 | 20 |
|
17 | 21 | function test_is_readable(tc, Ps) |
18 | 22 | ok = stdlib.is_readable(Ps{1}); |
19 | | -tc.verifyEqual(ok, Ps{2}) |
| 23 | +tc.verifyEqual(ok, Ps{2}, Ps{1}) |
20 | 24 | end |
21 | 25 |
|
22 | 26 |
|
| 27 | +function test_is_writable(tc, Ps) |
| 28 | +ok = stdlib.is_writable(Ps{1}); |
| 29 | +tc.verifyEqual(ok, Ps{2}, Ps{1}) |
| 30 | +end |
| 31 | + |
| 32 | +function test_is_writable_dir(tc) |
| 33 | +tc.assumeFalse(isMATLABReleaseOlderThan('R2022a')) |
| 34 | + |
| 35 | +td = tc.createTemporaryFolder(); |
| 36 | + |
| 37 | +tc.verifyTrue(stdlib.is_writable(td)) |
| 38 | +end |
| 39 | + |
23 | 40 | end |
24 | 41 |
|
25 | 42 | end |
0 commit comments