1- classdef (SharedTestFixtures = { matlab .unittest .fixtures .PathFixture(fileparts(fileparts(mfilename(' fullpath' ))))}, ...
2- TestTags = {' impure' }) ...
1+ classdef (SharedTestFixtures = { matlab .unittest .fixtures .PathFixture(fileparts(fileparts(mfilename(' fullpath' ))))}) ...
32 TestPermissions < matlab .unittest .TestCase
43
54properties (TestParameter )
98
109methods (TestMethodSetup )
1110function w_dirs(tc )
12- tc .applyFixture(matlab .unittest .fixtures .WorkingFolderFixture())
11+ tc .applyFixture(matlab .unittest .fixtures .WorkingFolderFixture());
1312end
1413end
1514
1615
17- methods (Test , TestTags = {' R2019b ' })
16+ methods (Test , TestTags = {' R2017b ' })
1817
1918function test_get_permissions(tc , Ps )
2019import matlab .unittest .constraints .StartsWithSubstring
@@ -32,20 +31,20 @@ function test_get_permissions(tc, Ps)
3231 end
3332
3433 tc .verifyThat(p , StartsWithSubstring(" r" ))
35- if isfile(p ) && stdlib .suffix(p ) == " .m "
34+ if isfile(p ) && strcmp( stdlib .suffix(p ), ' .m ' )
3635 tc .verifyEqual(p(3 ), ' -' )
3736 end
3837end
3938end
4039
4140
4241function test_get_permissions_exe(tc )
43- matlab_exe = fullfile( matlabroot , " bin/matlab" ) ;
42+ matlab_exe = [ matlabroot , ' / bin/matlab' ] ;
4443if ispc()
45- matlab_exe = matlab_exe + " .exe" ;
44+ matlab_exe = [ matlab_exe , ' .exe' ] ;
4645end
4746
48- tc .assertThat( matlab_exe , matlab . unittest . constraints . IsFile )
47+ tc .assertTrue(isfile( matlab_exe ) )
4948p = stdlib .get_permissions(matlab_exe );
5049
5150tc .assertNotEmpty(p )
@@ -57,7 +56,7 @@ function test_get_permissions_exe(tc)
5756function test_set_permissions_nowrite(tc )
5857import matlab .unittest .constraints .StartsWithSubstring
5958
60- nw = fullfile( pwd(), " no-write" ) ;
59+ nw = [ pwd(), ' / no-write' ] ;
6160
6261tc .assertTrue(stdlib .touch(nw ))
6362r = stdlib .set_permissions(nw , 0 , - 1 , 0 );
@@ -72,7 +71,7 @@ function test_set_permissions_nowrite(tc)
7271 tc .assertEqual(b , ' native' )
7372end
7473
75- if ~ispc() || b ~= " legacy"
74+ if ~ispc() || ~strcmp( b , ' legacy' )
7675 tc .verifyThat(p , StartsWithSubstring(" r-" ), " no-write permission failed to set" )
7776end
7877
@@ -90,7 +89,7 @@ function test_set_permissions_noread(tc)
9089% fileattrib can not even set the permissions on Linux.
9190tc .assumeFalse(stdlib .matlabOlderThan(' R2025a' ))
9291
93- nr = fullfile( pwd(), " no-read" ) ;
92+ nr = [ pwd(), ' / no-read' ] ;
9493
9594tc .assertTrue(stdlib .touch(nr ))
9695tc .assertTrue(stdlib .set_permissions(nr , - 1 , 0 , 0 ))
0 commit comments