11classdef TestResolve < matlab .unittest .TestCase
22
3+ methods (TestClassSetup )
4+
5+ function setup_path(tc )
6+ import matlab .unittest .fixtures .PathFixture
7+ cwd = fileparts(mfilename(" fullpath" ));
8+ top = fullfile(cwd , " .." );
9+ tc .applyFixture(PathFixture(top ))
10+ end
11+
12+ end
13+
14+
315methods (Test )
416
517
@@ -12,11 +24,20 @@ function test_absolute(tc)
1224td = tc .applyFixture(TemporaryFolderFixture ).Folder;
1325tc .applyFixture(CurrentFolderFixture(td ))
1426
15- tc .verifyEqual(stdlib .absolute(" " ), stdlib .posix(td ))
16- tc .verifyEqual(stdlib .absolute(" " ," " ), stdlib .posix(td ))
17- tc .verifyEqual(stdlib .absolute(" hi" ), stdlib .join(td , " hi" ))
18- tc .verifyEqual(stdlib .absolute(" " , " hi" ), stdlib .join(td , " hi" ))
19- tc .verifyEqual(stdlib .absolute(" there" , " hi" ), stdlib .join(td , " hi/there" ))
27+ td = stdlib .posix(td );
28+
29+ tc .verifyEqual(stdlib .absolute(" " ), td )
30+ tc .verifyEqual(stdlib .absolute(" " ," " ), td )
31+
32+ r = td + " /hi" ;
33+ tc .verifyEqual(stdlib .absolute(" hi" ), r )
34+ tc .verifyEqual(stdlib .absolute(" " , " hi" ), r )
35+ tc .verifyEqual(stdlib .absolute(" hi" , " " ), r )
36+
37+ tc .verifyEqual(stdlib .absolute(" ./hi" ), td + " /./hi" )
38+ tc .verifyEqual(stdlib .absolute(" ../hi" ), td + " /../hi" )
39+
40+ tc .verifyEqual(stdlib .absolute(" there" , " hi" ), td + " /hi/there" )
2041
2142end
2243
0 commit comments