11classdef (SharedTestFixtures = { matlab .unittest .fixtures .PathFixture(" .." )}, ...
2- TestTags = {' R2019b ' , ' pure' }) ...
2+ TestTags = {' R2021a ' , ' pure' }) ...
33 TestParent < matlab .unittest .TestCase
44
55properties (TestParameter )
6- p = init_parent()
6+ p
77end
88
9-
10- methods (Test , TestTags = [" R2019b" , "pure "])
11-
12- function test_parent(tc , p )
13- pr = stdlib .parent(p{1 });
14- tc .verifyEqual(pr , p{2 }, sprintf(" parent(%s)" , p{1 }))
15- end
16-
17- end
18-
19-
20- methods (Test , TestTags = [" R2020b" , "pure "])
21-
22- function test_parent_array(tc )
23- tc .assumeFalse(stdlib .matlabOlderThan(' R2020b' ))
24-
25- in = [" " , " ." , " .." , " ../.." , " a/" , " a/b" , " ab/.parent" , " ab/.parent.txt" , " a/b/../.parent.txt" ];
26- exp = [" ." , " ." , " ." , " .." , " ." , " a" , " ab" , " ab" , " a/b/.." ];
27-
28- out = stdlib .parent(in );
29- tc .verifyEqual(out , exp )
30- end
31-
32- end
33- end
34-
35-
9+ methods (TestParameterDefinition , Static )
3610function p = init_parent()
3711
3812p = {
@@ -59,3 +33,25 @@ function test_parent_array(tc)
5933p{end + 1 } = {' a//b' , " a" };
6034
6135end
36+ end
37+
38+
39+ methods (Test , TestTags = [" pure" ])
40+
41+ function test_parent(tc , p )
42+ pr = stdlib .parent(p{1 });
43+ tc .verifyEqual(pr , p{2 }, sprintf(" parent(%s)" , p{1 }))
44+ end
45+
46+
47+ function test_parent_array(tc )
48+
49+ in = [" " , " ." , " .." , " ../.." , " a/" , " a/b" , " ab/.parent" , " ab/.parent.txt" , " a/b/../.parent.txt" ];
50+ exp = [" ." , " ." , " ." , " .." , " ." , " a" , " ab" , " ab" , " a/b/.." ];
51+
52+ out = stdlib .parent(in );
53+ tc .verifyEqual(out , exp )
54+ end
55+
56+ end
57+ end
0 commit comments