77{" .." , pwd() + " /.." }, ...
88{pwd(), pwd() + " /." }}
99
10- same_fun = {@stdlib.samepath, @stdlib. sys.samepath, @stdlib. java.samepath, @stdlib. python.samepath, @stdlib. native.samepath }
10+ fun = {' sys' , ' java' , ' python' , ' native' }
1111end
1212
1313methods (TestClassSetup )
@@ -19,18 +19,25 @@ function pkg_path(tc)
1919
2020methods (Test )
2121
22- function test_samepath(tc , p_same , same_fun )
23- is_capable(tc , same_fun )
24-
25- tc .verifyTrue(same_fun(p_same{1 }, p_same{2 }))
22+ function test_samepath(tc , p_same , fun )
23+ tc .assertNotEmpty(which(" stdlib." + fun + " .samepath" ))
24+ try
25+ y = stdlib .samepath(p_same{: }, fun );
26+ tc .verifyTrue(y )
27+ catch e
28+ tc .verifyEqual(e .identifier , ' stdlib:choose_method:NameError' , e .message )
29+ end
2630end
2731
28- function test_samepath_notexist(tc , same_fun )
29- is_capable(tc , same_fun )
3032
31- tc .verifyFalse(same_fun( " " , " " ) )
33+ function test_samepath_notexist( tc , fun )
3234t = tempname();
33- tc .verifyFalse(same_fun(t , t ))
35+ try
36+ tc .verifyFalse(stdlib .samepath(" " , " " , fun ))
37+ tc .verifyFalse(stdlib .samepath(t , t , fun ))
38+ catch e
39+ tc .verifyEqual(e .identifier , ' stdlib:choose_method:NameError' , e .message )
40+ end
3441end
3542
3643end
0 commit comments