Skip to content

Commit 0598a87

Browse files
committed
testExists < R2020b
1 parent ead51e4 commit 0598a87

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

test/TestExists.m

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,8 @@
33
TestExists < matlab.unittest.TestCase
44

55
properties (TestParameter)
6-
Ps
7-
B_is_char_device
8-
end
9-
10-
11-
methods (TestParameterDefinition, Static)
12-
function Ps = init_val()
13-
Ps = {
14-
{pwd(), true}, ...
15-
{mfilename("fullpath") + ".m", true}, ...
16-
{fileparts(mfilename("fullpath")) + "/../Readme.md", true}, ...
17-
{tempname(), false}, ...
18-
{'', false}, ...
19-
{"", false}
20-
};
21-
if ispc()
22-
% On Windows, the root of the system drive is considered to exist
23-
systemDrive = getenv("SystemDrive");
24-
if ~isempty(systemDrive)
25-
Ps{end+1} = {systemDrive, true};
26-
end
27-
end
28-
end
29-
30-
function B_is_char_device = setupBackends()
31-
B_is_char_device = init_backend("is_char_device");
32-
end
6+
Ps = init_val()
7+
B_is_char_device = {'python', 'sys'}
338
end
349

3510

@@ -40,7 +15,7 @@ function test_dirs(tc)
4015
end
4116

4217

43-
methods (Test, TestTags={'R2021a'})
18+
methods (Test, TestTags={'R2019b'})
4419

4520
function test_exists(tc, Ps)
4621
ok = stdlib.exists(Ps{1});
@@ -67,7 +42,11 @@ function test_is_char_device(tc, B_is_char_device)
6742
tc.assertEqual(char(b), B_is_char_device)
6843
tc.assertClass(r, 'logical')
6944

70-
tc.verifyTrue(r, n)
45+
if ismember(B_is_char_device, stdlib.Backend().select('is_char_device'))
46+
tc.verifyTrue(r, n)
47+
else
48+
tc.verifyEmpty(r)
49+
end
7150
end
7251

7352
end
@@ -97,3 +76,22 @@ function test_is_writable_array(tc)
9776
end
9877

9978
end
79+
80+
81+
function Ps = init_val()
82+
Ps = {
83+
{pwd(), true}, ...
84+
{mfilename("fullpath") + ".m", true}, ...
85+
{fileparts(mfilename("fullpath")) + "/../Readme.md", true}, ...
86+
{tempname(), false}, ...
87+
{'', false}, ...
88+
{"", false}
89+
};
90+
if ispc()
91+
% On Windows, the root of the system drive is considered to exist
92+
systemDrive = getenv("SystemDrive");
93+
if ~isempty(systemDrive)
94+
Ps{end+1} = {systemDrive, true};
95+
end
96+
end
97+
end

0 commit comments

Comments
 (0)