11classdef (SharedTestFixtures = { matlab .unittest .fixtures .PathFixture(fileparts(fileparts(mfilename(' fullpath' ))))}, ...
2- TestTags = {' R2019b ' , ' pure' }) ...
2+ TestTags = {' R2017b ' , ' pure' }) ...
33 TestRelative < matlab .unittest .TestCase
44
55
1212
1313function test_relative_to(tc , pr )
1414r = stdlib .relative_to(pr{1 }, pr{2 });
15-
1615tc .verifyEqual(r , pr{3 }, " relative_to(" + pr{1 } + " ," + pr{2 }+" )" )
16+
17+ r = stdlib .relative_to(string(pr{1 }), pr{2 });
18+ tc .verifyEqual(r , string(pr{3 }))
1719end
1820
1921function test_proximate_to(tc , pr )
2022r = stdlib .proximate_to(pr{1 }, pr{2 });
21-
2223tc .verifyEqual(r , pr{3 }, " proximate_to(" + pr{1 } + " , " + pr{2 }+" )" )
24+
25+ r = stdlib .proximate_to(string(pr{1 }), pr{2 });
26+ tc .verifyEqual(r , string(pr{3 }))
2327end
2428
2529end
@@ -28,13 +32,18 @@ function test_proximate_to(tc, pr)
2832
2933function pr = init_rel()
3034
35+ pr = {{' ' , ' ' , ' ' }, ...
36+ {pwd(), pwd(), ' .' }, ...
37+ {fileparts(pwd()), pwd(), ' test' }
38+ };
39+
40+
3141root = fileparts(fileparts(mfilename(' fullpath' )));
42+ if ~isempty(root )
43+ pr{end + 1 } = {root , [root , ' /test/' , mfilename(), ' .m' ], [' test/' , mfilename , ' .m' ]};
44+ end
45+
3246
33- pr = {{" " , " " , " " }, ...
34- {pwd(), pwd(), " ." }, ...
35- {fileparts(pwd()), pwd(), " test" }, ...
36- {root , fullfile(root , " test" , mfilename() + " .m" ), fullfile(" test" , mfilename + " .m" )}
37- };
3847% NOTE: ".." in relative_to(base) is ambiguous including for python.pathlib, C++ <filesystem>, etc.
3948
4049% if stdlib.has_python() || stdlib.has_dotnet()
@@ -67,8 +76,8 @@ function test_proximate_to(tc, pr)
6776else
6877
6978pr = [pr , {
70- {" / " , " / " , " . " }, ...
71- {" /dev/null" , " /dev/null" , " . " }, ...
79+ {' / ' , ' / ' , ' . ' }, ...
80+ {' /dev/null' , ' /dev/null' , ' . ' }, ...
7281}];
7382end
7483end
0 commit comments