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' ))))}) ...
3
2
TestPermissions < matlab .unittest .TestCase
4
3
5
4
properties (TestParameter )
9
8
10
9
methods (TestMethodSetup )
11
10
function w_dirs(tc )
12
- tc .applyFixture(matlab .unittest .fixtures .WorkingFolderFixture())
11
+ tc .applyFixture(matlab .unittest .fixtures .WorkingFolderFixture());
13
12
end
14
13
end
15
14
16
15
17
- methods (Test , TestTags = {' R2019b ' })
16
+ methods (Test , TestTags = {' R2017b ' })
18
17
19
18
function test_get_permissions(tc , Ps )
20
19
import matlab .unittest .constraints .StartsWithSubstring
@@ -32,20 +31,20 @@ function test_get_permissions(tc, Ps)
32
31
end
33
32
34
33
tc .verifyThat(p , StartsWithSubstring(" r" ))
35
- if isfile(p ) && stdlib .suffix(p ) == " .m "
34
+ if isfile(p ) && strcmp( stdlib .suffix(p ), ' .m ' )
36
35
tc .verifyEqual(p(3 ), ' -' )
37
36
end
38
37
end
39
38
end
40
39
41
40
42
41
function test_get_permissions_exe(tc )
43
- matlab_exe = fullfile( matlabroot , " bin/matlab" ) ;
42
+ matlab_exe = [ matlabroot , ' / bin/matlab' ] ;
44
43
if ispc()
45
- matlab_exe = matlab_exe + " .exe" ;
44
+ matlab_exe = [ matlab_exe , ' .exe' ] ;
46
45
end
47
46
48
- tc .assertThat( matlab_exe , matlab . unittest . constraints . IsFile )
47
+ tc .assertTrue(isfile( matlab_exe ) )
49
48
p = stdlib .get_permissions(matlab_exe );
50
49
51
50
tc .assertNotEmpty(p )
@@ -57,7 +56,7 @@ function test_get_permissions_exe(tc)
57
56
function test_set_permissions_nowrite(tc )
58
57
import matlab .unittest .constraints .StartsWithSubstring
59
58
60
- nw = fullfile( pwd(), " no-write" ) ;
59
+ nw = [ pwd(), ' / no-write' ] ;
61
60
62
61
tc .assertTrue(stdlib .touch(nw ))
63
62
r = stdlib .set_permissions(nw , 0 , - 1 , 0 );
@@ -72,7 +71,7 @@ function test_set_permissions_nowrite(tc)
72
71
tc .assertEqual(b , ' native' )
73
72
end
74
73
75
- if ~ispc() || b ~= " legacy"
74
+ if ~ispc() || ~strcmp( b , ' legacy' )
76
75
tc .verifyThat(p , StartsWithSubstring(" r-" ), " no-write permission failed to set" )
77
76
end
78
77
@@ -90,7 +89,7 @@ function test_set_permissions_noread(tc)
90
89
% fileattrib can not even set the permissions on Linux.
91
90
tc .assumeFalse(stdlib .matlabOlderThan(' R2025a' ))
92
91
93
- nr = fullfile( pwd(), " no-read" ) ;
92
+ nr = [ pwd(), ' / no-read' ] ;
94
93
95
94
tc .assertTrue(stdlib .touch(nr ))
96
95
tc .assertTrue(stdlib .set_permissions(nr , - 1 , 0 , 0 ))
0 commit comments