File tree Expand file tree Collapse file tree 4 files changed +13
-17
lines changed Expand file tree Collapse file tree 4 files changed +13
-17
lines changed Original file line number Diff line number Diff line change 1- function c = canonical_legacy (file , strict )
1+ function c = canonical (file , strict )
22
33c = " " ;
44
Original file line number Diff line number Diff line change 1212% %% Outputs
1313% * c: canonical path, if determined
1414
15- function c = canonical(p , strict )
15+ function c = canonical(p , strict , method )
1616arguments
1717 p {mustBeTextScalar }
1818 strict (1 ,1 ) logical = false
19+ method (1 ,: ) string = [" native" , " legacy" ]
1920end
2021
22+ fun = choose_method(method , " canonical" , ' R2024a' );
2123
22- if isMATLABReleaseOlderThan(' R2024a' )
23- c = stdlib .native .canonical_legacy(p , strict );
24- else
25- c = stdlib .native .canonical(p , strict );
26- end
24+ c = fun(p , strict );
2725
2826end
Original file line number Diff line number Diff line change 99{" not-exist/a/.." , " not-exist" }, ...
1010{" ./not-exist" , " not-exist" }
1111};
12- fun = {@stdlib.canonical, @stdlib. native.canonical, @stdlib.native.canonical_legacy }
12+ fun = {" native" , " legacy " }
1313end
1414
1515methods (TestClassSetup )
@@ -23,9 +23,13 @@ function pkg_path(tc)
2323methods (Test , TestTags = " impure" )
2424
2525function test_canonical(tc , p , fun )
26- is_capable(tc , fun )
27-
28- tc .verifyEqual(fun(p{1 }, false ), p{2 })
26+ try
27+ c = stdlib .canonical(p{1 }, false , fun );
28+ catch e
29+ tc .verifyEqual(e .identifier , ' stdlib:choose_method:NameError' , e .message )
30+ return
31+ end
32+ tc .verifyEqual(c , p{2 })
2933end
3034
3135end
Original file line number Diff line number Diff line change @@ -42,12 +42,6 @@ function is_capable(tc, f)
4242 tc .assumeTrue(isunix(), " unix only function" )
4343 end
4444
45- elseif contains(n , " .native." )
46-
47- if endsWith(n , " canonical" )
48- tc .assumeFalse(isMATLABReleaseOlderThan(' R2024a' ))
49- end
50-
5145end
5246
5347end
You can’t perform that action at this time.
0 commit comments