22
33properties (TestParameter )
44Ps = {" ." , pwd(), " " , tempname(), mfilename(' fullpath' ) + " .m" }
5- sp_fun = {' native' , ' legacy' }
5+ fname = {' native' , ' legacy' }
66end
77
88methods (TestClassSetup )
@@ -14,11 +14,15 @@ function pkg_path(tc)
1414
1515methods (Test , TestTags = " impure" )
1616
17- function test_get_permissions(tc , Ps )
17+ function test_get_permissions(tc , Ps , fname )
1818import matlab .unittest .constraints .StartsWithSubstring
1919
20- p = stdlib .get_permissions(Ps );
21-
20+ try
21+ p = stdlib .get_permissions(Ps , fname );
22+ catch e
23+ tc .verifyEqual(e .identifier , ' stdlib:choose_method:NameError' )
24+ return
25+ end
2226tc .verifyClass(p , " char" )
2327
2428if stdlib .exists(Ps )
@@ -54,7 +58,7 @@ function test_set_permissions_noread(tc)
5458end
5559
5660
57- function test_set_permissions_nowrite(tc , sp_fun )
61+ function test_set_permissions_nowrite(tc , fname )
5862import matlab .unittest .constraints .StartsWithSubstring
5963
6064tc .assumeFalse(isMATLABReleaseOlderThan(' R2022a' ))
@@ -64,15 +68,14 @@ function test_set_permissions_nowrite(tc, sp_fun)
6468
6569tc .verifyTrue(stdlib .touch(nw ))
6670try
67- tc .verifyTrue(stdlib .set_permissions(nw , 0 , - 1 , 0 , sp_fun ))
71+ tc .verifyTrue(stdlib .set_permissions(nw , 0 , - 1 , 0 , fname ))
6872catch e
6973 tc .verifyEqual(e .identifier , ' stdlib:choose_method:NameError' )
7074 return
7175end
7276
73-
7477p = stdlib .get_permissions(nw );
75- if ~ispc() || sp_fun ~= " legacy"
78+ if ~ispc() || fname ~= " legacy"
7679 tc .verifyThat(p , StartsWithSubstring(" r-" ), " no-write permission failed to set" )
7780end
7881
0 commit comments