|
1 | 1 | classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture("..")}, ... |
2 | | - TestTags = {'R2019b', 'impure'}) ... |
| 2 | + TestTags = {'impure'}) ... |
3 | 3 | TestWhich < matlab.unittest.TestCase |
4 | 4 |
|
5 | 5 | properties (TestParameter) |
|
8 | 8 | end |
9 | 9 |
|
10 | 10 |
|
11 | | -methods (Test) |
| 11 | +methods (Test, TestTags = {'R2019b'}) |
12 | 12 |
|
13 | 13 | function test_which_name(tc) |
14 | 14 |
|
@@ -46,27 +46,34 @@ function test_which_absolute(tc, mexe) |
46 | 46 |
|
47 | 47 | tc.verifyGreaterThan(strlength(stdlib.which(r)), 0, "Expected which(" + r + " ) to find " + r) |
48 | 48 | tc.verifyGreaterThan(strlength(stdlib.which(mexe)), 0, "Expected which(" + mexe + ") to find " + r) |
49 | | - |
50 | 49 | end |
51 | 50 |
|
52 | 51 |
|
53 | 52 | function test_which_onepath(tc) |
54 | | - |
55 | 53 | tc.verifyNotEmpty(stdlib.which("matlab", fullfile(matlabroot, 'bin')), ... |
56 | 54 | "Matlab not found by which() given specific path=") |
57 | | - |
58 | 55 | end |
59 | 56 |
|
60 | 57 |
|
61 | 58 | function test_which_multipath(tc) |
62 | | - |
63 | 59 | paths = split(string(getenv('PATH')), pathsep); |
64 | 60 | paths(end+1) = fullfile(matlabroot, 'bin'); |
65 | 61 |
|
66 | 62 | tc.verifyNotEmpty(stdlib.which("matlab", paths), "Matlab not found by which()") |
| 63 | +end |
67 | 64 |
|
68 | 65 | end |
69 | 66 |
|
| 67 | + |
| 68 | +methods(Test, TestTags={'R2023a'}) |
| 69 | +function testWhichNoPath(tc) |
| 70 | +tc.assumeFalse(isMATLABReleaseOlderThan('R2023a')) |
| 71 | +fx = matlab.unittest.fixtures.EnvironmentVariableFixture('PATH', ''); |
| 72 | +tc.applyFixture(fx) |
| 73 | + |
| 74 | +tc.verifyEmpty(stdlib.which('matlab'), "Matlab found by which() given empty path") |
| 75 | +tc.verifyNotEmpty(stdlib.which('matlab', matlabroot + "/bin")) |
| 76 | +end |
70 | 77 | end |
71 | 78 |
|
72 | 79 | end |
0 commit comments