33 TestExists < matlab .unittest .TestCase
44
55properties (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' }
338end
349
3510
@@ -40,7 +15,7 @@ function test_dirs(tc)
4015end
4116
4217
43- methods (Test , TestTags = {' R2021a ' })
18+ methods (Test , TestTags = {' R2019b ' })
4419
4520function test_exists(tc , Ps )
4621ok = stdlib .exists(Ps{1 });
@@ -67,7 +42,11 @@ function test_is_char_device(tc, B_is_char_device)
6742tc .assertEqual(char(b ), B_is_char_device )
6843tc .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
7150end
7251
7352end
@@ -97,3 +76,22 @@ function test_is_writable_array(tc)
9776end
9877
9978end
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