Skip to content

Commit 05be111

Browse files
committed
test:absolute: improve coverage
1 parent 5fc2df9 commit 05be111

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

test/TestAbsolute.m

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,16 @@
44
td
55
end
66

7-
87
properties (TestParameter)
9-
p1
10-
p2
11-
end
12-
13-
14-
methods (TestParameterDefinition, Static)
15-
16-
function p1 = init1arg()
17-
p1 = {"", "hi", "./hi", "../hi"};
18-
end
19-
20-
function p2 = init2arg()
21-
p2 = {{"", ""}, {"", "hi"}, {"hi", ""}, {"there", "hi"}};
22-
end
23-
8+
p1 = {'', "", "hi", "./hi", "../hi"};
9+
p2 = {{'', ''}, {'', ""}, {"", ''}, {"", ""}, {"", "hi"}, {"hi", ""}, {'there', "hi"}};
2410
end
2511

2612

2713
methods(TestClassSetup)
2814
function set_cwd(tc)
2915
import matlab.unittest.fixtures.CurrentFolderFixture
30-
tc.td = string(stdlib.posix(tc.createTemporaryFolder()));
16+
tc.td = stdlib.posix(tc.createTemporaryFolder());
3117
tc.applyFixture(CurrentFolderFixture(tc.td))
3218
end
3319
end
@@ -40,7 +26,11 @@ function test_absolute1arg(tc, p1)
4026
r = tc.td;
4127

4228
if strlength(p1)
43-
r = r + "/" + p1;
29+
r = strcat(r, '/', p1);
30+
end
31+
32+
if isstring(p1)
33+
r = string(r);
4434
end
4535

4636
tc.verifyEqual(stdlib.absolute(p1), r)
@@ -52,11 +42,15 @@ function test_absolute2arg(tc, p2)
5242
r = tc.td;
5343

5444
if strlength(p2{2})
55-
r = r + "/" + p2{2};
45+
r = strcat(r, '/', p2{2});
5646
end
5747

5848
if strlength(p2{1})
59-
r = r + "/" + p2{1};
49+
r = strcat(r, '/', p2{1});
50+
end
51+
52+
if isstring(p2{1})
53+
r = string(r);
6054
end
6155

6256
tc.verifyEqual(stdlib.absolute(p2{1}, p2{2}), r)

0 commit comments

Comments
 (0)