|
1 | 1 | classdef TestFileImpure < matlab.unittest.TestCase |
2 | 2 |
|
3 | 3 | properties(TestParameter) |
| 4 | +use_java = num2cell(unique([stdlib.has_java(), false])) |
| 5 | + |
4 | 6 | p_exists = {{pwd(), true}, {mfilename("fullpath") + ".m", true}, {"TestFileImpure.m", true} {tempname, false}} |
5 | 7 | % on CI matlabroot can be writable! |
6 | 8 |
|
|
20 | 22 |
|
21 | 23 | methods (Test) |
22 | 24 |
|
23 | | -function test_exists(tc, p_exists) |
24 | | -ok = stdlib.exists(p_exists{1}, stdlib.has_java()); |
| 25 | +function test_exists(tc, p_exists, use_java) |
| 26 | +ok = stdlib.exists(p_exists{1}, use_java); |
25 | 27 | tc.verifyEqual(ok, p_exists{2}) |
26 | 28 | end |
27 | 29 |
|
28 | | -function test_file_size(tc) |
29 | | -s = stdlib.file_size(mfilename("fullpath") + ".m", stdlib.has_java()); |
| 30 | +function test_file_size(tc, use_java) |
| 31 | +s = stdlib.file_size(mfilename("fullpath") + ".m", use_java); |
30 | 32 | tc.verifyGreaterThan(s, 0) |
31 | 33 | end |
32 | 34 |
|
33 | 35 |
|
34 | | -function test_is_readable(tc, p_exists) |
35 | | -ok = stdlib.is_readable(p_exists{1}, stdlib.has_java()); |
| 36 | +function test_is_readable(tc, p_exists, use_java) |
| 37 | +ok = stdlib.is_readable(p_exists{1}, use_java); |
36 | 38 | tc.verifyEqual(ok, p_exists{2}) |
37 | 39 | end |
38 | 40 |
|
39 | 41 |
|
40 | | -function test_is_writable(tc, p_is_writable) |
41 | | -ok = stdlib.is_writable(p_is_writable{1}, stdlib.has_java()); |
| 42 | +function test_is_writable(tc, p_is_writable, use_java) |
| 43 | +ok = stdlib.is_writable(p_is_writable{1}, use_java); |
42 | 44 | tc.verifyEqual(ok, p_is_writable{2}) |
43 | 45 | end |
44 | 46 |
|
45 | 47 |
|
46 | | -function test_expanduser(tc, p_expand) |
47 | | -tc.verifyEqual(stdlib.expanduser(p_expand{1}), p_expand{2}) |
| 48 | +function test_expanduser(tc, p_expand, use_java) |
| 49 | +tc.verifyEqual(stdlib.expanduser(p_expand{1}), p_expand{2}, use_java) |
48 | 50 | end |
49 | 51 |
|
50 | 52 |
|
|
0 commit comments