66end
77
88properties (TestParameter )
9- Ps = {' .' , pwd(), ' ' , tempname(), ' perm.txt' }
9+ Ps = {' .' , pwd(), ' perm.txt' }
10+ Pe = {' ' , tempname()}
1011end
1112
1213
@@ -20,25 +21,28 @@ function w_dirs(tc)
2021
2122methods (Test , TestTags = {' R2016a' })
2223
24+ function test_not_exist(tc , Pe )
25+
26+ e = ' MATLAB:io:filesystem:filePermissions:CannotFindLocation' ;
27+ tc .verifyError(@() stdlib .get_permissions(Pe ), e )
28+
29+ end
30+
2331function test_get_permissions(tc , Ps )
2432import matlab .unittest .constraints .StartsWithSubstring
2533
2634[p , b ] = stdlib .get_permissions(Ps );
2735tc .verifyClass(p , ' char' )
2836
29- if ~ stdlib .exists( Ps )
30- tc .verifyEmpty( p )
37+ if stdlib .matlabOlderThan( ' R2025a ' )
38+ tc .assertEqual( b , ' legacy ' )
3139else
32- if stdlib .matlabOlderThan(' R2025a' )
33- tc .assertEqual(b , ' legacy' )
34- else
35- tc .assertEqual(b , ' native' )
36- end
37-
38- tc .verifyThat(p , StartsWithSubstring(' r' ))
39- if ~ispc() && strcmp(Ps , tc .file)
40- tc .verifyEqual(p(3 ), ' -' )
41- end
40+ tc .assertEqual(b , ' native' )
41+ end
42+
43+ tc .verifyThat(p , StartsWithSubstring(' r' ))
44+ if ~ispc() && strcmp(Ps , tc .file)
45+ tc .verifyEqual(p(3 ), ' -' )
4246end
4347end
4448
0 commit comments