|
1 | 1 | classdef TestFileImpure < matlab.unittest.TestCase |
2 | 2 |
|
3 | 3 | properties(TestParameter) |
4 | | -p_is_writable = {{pwd(), true}, {"not-exists", false}}; |
| 4 | +p_is_writable = {{pwd(), true}, {"not-exists", false}, {"file:///", false}, {"", false}}; |
5 | 5 |
|
6 | 6 | p_expand = {{"", ""}, {"~abc", "~abc"}, {"~", stdlib.homedir()}, {"~/c", stdlib.homedir() + "/c"}, {'~/////c', stdlib.homedir() + "/c"}}; |
7 | 7 |
|
8 | 8 | p_same = {... |
9 | 9 | {"","", false}, ... |
10 | 10 | {tempname, tempname, false}, ... |
11 | 11 | {"..", "./..", true}, ... |
12 | | -{"..", pwd() + "/..", true}} |
| 12 | +{"..", pwd() + "/..", true}, ... |
| 13 | +{"file:///", "file:///", false}} |
13 | 14 |
|
14 | 15 | ph = {{0, '"stdin"'}, {1, '"stdout"'}, {2, '"stderr"'}, {fopen(tempname), ""}} |
| 16 | + |
| 17 | +p_file_size = {mfilename("fullpath") + ".m", "", "file:///", pwd()} |
15 | 18 | end |
16 | 19 |
|
17 | 20 |
|
18 | 21 | methods (Test) |
19 | 22 |
|
20 | | -function test_file_size(tc) |
21 | | -s = stdlib.file_size(mfilename("fullpath") + ".m"); |
22 | | -tc.verifyGreaterThan(s, 0) |
| 23 | +function test_file_size(tc, p_file_size) |
| 24 | +s = stdlib.file_size(p_file_size); |
| 25 | +if isfile(p_file_size) |
| 26 | + tc.verifyGreaterThan(s, 0) |
| 27 | +else |
| 28 | + tc.verifyEmpty(s) |
| 29 | +end |
23 | 30 | end |
24 | 31 |
|
25 | 32 |
|
@@ -50,7 +57,8 @@ function test_makedir(tc) |
50 | 57 |
|
51 | 58 | %% |
52 | 59 | function test_samepath(tc, p_same) |
53 | | -tc.verifyEqual(stdlib.samepath(p_same{1}, p_same{2}), p_same{3}, "samepath(" + p_same{1} + "," + p_same{2} + ")") |
| 60 | +tc.verifyEqual(stdlib.samepath(p_same{1}, p_same{2}), p_same{3}, ... |
| 61 | + "samepath(" + p_same{1} + "," + p_same{2} + ")") |
54 | 62 | end |
55 | 63 |
|
56 | 64 |
|
|
0 commit comments