11classdef (SharedTestFixtures = { matlab .unittest .fixtures .PathFixture(fileparts(fileparts(mfilename(' fullpath' ))))}) ...
22 TestPermissions < matlab .unittest .TestCase
33
4+ properties
5+ file = ' perm.txt'
6+ end
7+
48properties (TestParameter )
5- Ps = {" ." , pwd(), " " , tempname(), mfilename( ' fullpath ' ) + " .m " }
9+ Ps = {" ." , pwd(), " " , tempname(), ' perm.txt ' }
610end
711
812
9- methods (TestMethodSetup )
13+ methods (TestClassSetup )
1014function w_dirs(tc )
1115 tc .applyFixture(matlab .unittest .fixtures .WorkingFolderFixture());
16+ tc .assertTrue(stdlib .touch(tc .file ))
1217end
1318end
1419
1520
16- methods (Test , TestTags = {' R2017b ' })
21+ methods (Test , TestTags = {' R2017a ' })
1722
1823function test_get_permissions(tc , Ps )
1924import matlab .unittest .constraints .StartsWithSubstring
2025
2126[p , b ] = stdlib .get_permissions(Ps );
22- tc .verifyClass(p , " char" )
27+ tc .verifyClass(p , ' char' )
2328
2429if ~stdlib .exists(Ps )
2530 tc .verifyEmpty(p )
@@ -30,8 +35,8 @@ function test_get_permissions(tc, Ps)
3035 tc .assertEqual(b , ' native' )
3136 end
3237
33- tc .verifyThat(p , StartsWithSubstring(" r " ))
34- if isfile( p ) && strcmp(stdlib .suffix( p ), ' .m ' )
38+ tc .verifyThat(p , StartsWithSubstring(' r ' ))
39+ if strcmp(Ps , tc . file )
3540 tc .verifyEqual(p(3 ), ' -' )
3641 end
3742end
@@ -44,7 +49,6 @@ function test_get_permissions_exe(tc)
4449 matlab_exe = [matlab_exe , ' .exe' ];
4550end
4651
47- tc .assertTrue(isfile(matlab_exe ))
4852p = stdlib .get_permissions(matlab_exe );
4953
5054tc .assertNotEmpty(p )
0 commit comments