Skip to content

Commit b16ba3b

Browse files
committed
testRoot: use_java
1 parent 717c65e commit b16ba3b

File tree

2 files changed

+42
-17
lines changed

2 files changed

+42
-17
lines changed

test/TestFilePure.m

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,21 @@
11
classdef TestFilePure < matlab.unittest.TestCase
22

33
properties (TestParameter)
4-
p_root
5-
p_root_name
4+
p
65
end
76

87

98
methods (TestParameterDefinition, Static)
109

11-
function [p_root, p_root_name] = init_relative_to()
10+
function p = init()
1211

13-
p_root = {{"", ""}, ...
14-
{"a/b", ""}, ...
15-
{"./a/b", ""}, ...
16-
{"/etc", "/"}, ...
17-
{"c:", ""}, ...
18-
{"c:/etc", ""}};
19-
20-
p_root_name = {{"", ""}, ...
12+
p = {{"", ""}, ...
2113
{"a/b", ""}, ...
2214
{"/etc", ""}, ...
2315
{"c:/etc", ""}};
2416

2517
if ispc
26-
p_root{5}{2} = "c:";
27-
p_root{6}{2} = "c:/";
28-
29-
p_root_name{4}{2} = "c:";
18+
p{4}{2} = "c:";
3019
end
3120

3221
end
@@ -46,8 +35,8 @@ function test_posix(tc)
4635
end
4736
end
4837

49-
function test_root(tc, p_root)
50-
tc.verifyEqual(stdlib.root(p_root{1}), p_root{2})
38+
function test_root_name(tc, p)
39+
tc.verifyEqual(stdlib.root_name(p{1}), p{2})
5140
end
5241

5342
end

test/TestRoot.m

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
classdef TestRoot < matlab.unittest.TestCase
2+
3+
properties (TestParameter)
4+
use_java = num2cell(unique([stdlib.has_java(), false]))
5+
p
6+
end
7+
8+
9+
methods (TestParameterDefinition, Static)
10+
11+
function p = init()
12+
13+
p = {{"", ""}, ...
14+
{"a/b", ""}, ...
15+
{"./a/b", ""}, ...
16+
{"/etc", "/"}, ...
17+
{"c:", ""}, ...
18+
{"c:/etc", ""}};
19+
20+
if ispc
21+
p{5}{2} = "c:";
22+
p{6}{2} = "c:/";
23+
end
24+
25+
end
26+
27+
end
28+
29+
30+
methods (Test)
31+
function test_root(tc, p, use_java)
32+
tc.verifyEqual(stdlib.root(p{1}, use_java), p{2})
33+
end
34+
end
35+
36+
end

0 commit comments

Comments
 (0)