55pp = init_prox()
66end
77
8- methods (Test , TestTags = " mex " )
8+ methods (Test )
99
1010function test_relative_to(tc , pr )
11- tc .assertTrue( stdlib .is_mex_fun(" stdlib.relative_to" ))
11+ tc .assumeTrue(( stdlib .has_dotnet() && stdlib .dotnet_api() >= 5 ) || stdlib .is_mex_fun(" stdlib.relative_to" ))
1212
1313tc .verifyEqual(stdlib .relative_to(pr{1 }, pr{2 }), pr{3 }, ...
1414 " relative_to(" + pr{1 } + " ," + pr{2 }+" )" )
1515end
1616
1717function test_proximate_to(tc , pp )
18- tc .assertTrue( stdlib .is_mex_fun(" stdlib.proximate_to" ))
18+ tc .assumeTrue(( stdlib .has_dotnet() && stdlib .dotnet_api() >= 5 ) || stdlib .is_mex_fun(" stdlib.proximate_to" ))
1919
2020tc .verifyEqual(stdlib .proximate_to(pp{1 }, pp{2 }), pp{3 }, ...
21- " proximate_to(" + pp{1 } + " ," + pp{2 }+" )" )
21+ " proximate_to(" + pp{1 } + " , " + pp{2 }+" )" )
2222end
2323
2424end
@@ -32,30 +32,32 @@ function test_proximate_to(tc, pp)
3232{" Hello" , " Hello/" , " ." }, ...
3333{" a/./b" , " a/b" , " ." }, ...
3434{" a/b" , " a/./b" , " ." }, ...
35- {" ./a/b" , " ./a/c" , " ../c " }, ...
35+ {" ./a/b" , " ./a/c" , fullfile( " .." , " c " ) }, ...
3636{" /" , " /" , " ." }, ...
37- {" a/b/c/d" , " a/b" , " ../ .." }, ...
38- {" a/b" , " a/c" , " ../c " }, ...
39- {" a/b" , " c" , " ../../c " }, ...
40- {" c" , " a/b" , " ../a/b " }, ...
37+ {" a/b/c/d" , " a/b" , fullfile( " .." , " .." ) }, ...
38+ {" a/b" , " a/c" , fullfile( " .." , " c " ) }, ...
39+ {" a/b" , " c" , fullfile( " .." , " .. " , " c " ) }, ...
40+ {" c" , " a/b" , fullfile( " .." , " a " , " b " ) }, ...
4141{" a/b" , " a/b" , " ." }, ...
4242{" a/b" , " a" , " .." }
4343};
4444% NOTE: ".." in relative_to(base) is ambiguous including for python.pathlib, C++ <filesystem>, etc.
4545
4646if ispc
4747p = [p , ...
48- {{" C:/a/b" , " C:/" , " ../ .." }, ...
49- {" C:/" , " C:/a/b" , " a/b " }, ...
48+ {{" C:/a/b" , " C:/" , fullfile( " .." , " .." ) }, ...
49+ {" C:/" , " C:/a/b" , fullfile( " a " , " b " ) }, ...
5050{" c:/a/b" , " c:/a/b" , " ." }, ...
5151{" c:/a/b" , " c:/a" , " .." }, ...
52- {" c:\a/b\c/d" , " c:/a\b" , " ../.." }, ...
53- {" C:/path" , " D:/path" , " " }}];
52+ {" c:\a/b\c/d" , " c:/a\b" , fullfile(" .." , " .." )}, ...
53+ {" C:/path" , " D:/path" , " " }, ...
54+ {" D:/a/b" , " c" , " " }}];
5455% note: on Windows the drive letter should be uppercase!
5556else
5657 p = [p , ...
5758{{" " , " a" , " a" }, ...
58- {" /dev/null" , " /dev/null" , " ." }}];
59+ {" /dev/null" , " /dev/null" , " ." }, ...
60+ {" /a/b" , " c" , " " }}];
5961end
6062
6163end
@@ -67,7 +69,8 @@ function test_proximate_to(tc, pp)
6769
6870
6971if ispc
70- p{end }{3 } = " D:/path" ;
72+ p{end - 1 }{3 } = fullfile(" D:" , " path" );
73+ p{end }{3 } = " c" ;
7174end
7275
7376end
0 commit comments