Skip to content

Commit 7f704fa

Browse files
committed
increase test coverage
1 parent ee4feb8 commit 7f704fa

File tree

2 files changed

+30
-15
lines changed

2 files changed

+30
-15
lines changed

test/TestExists.m

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}, ...
2-
TestTags = {'impure'}) ...
1+
classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}) ...
32
TestExists < matlab.unittest.TestCase
43

54
properties (TestParameter)
@@ -18,19 +17,28 @@ function test_dirs(tc)
1817
methods (Test, TestTags={'R2018a'})
1918

2019
function test_exists(tc, Ps)
21-
ok = stdlib.exists(Ps{1});
22-
tc.verifyEqual(ok, Ps{2}, Ps{1})
20+
r = stdlib.exists(Ps{1});
21+
tc.verifyEqual(r, Ps{2}, Ps{1})
22+
23+
r = stdlib.exists(string(Ps{1}));
24+
tc.verifyEqual(r, Ps{2})
2325
end
2426

2527

2628
function test_is_readable(tc, Ps)
2729
r = stdlib.is_readable(Ps{1});
2830
tc.verifyEqual(r, Ps{2})
31+
32+
r = stdlib.is_readable(string(Ps{1}));
33+
tc.verifyEqual(r, Ps{2});
2934
end
3035

3136
function test_is_writable(tc, Ps)
3237
r = stdlib.is_writable(Ps{1});
3338
tc.verifyEqual(r, Ps{2})
39+
40+
r = stdlib.is_writable(string(Ps{1}));
41+
tc.verifyEqual(r, Ps{2});
3442
end
3543
end
3644

@@ -46,6 +54,8 @@ function test_is_char_device(tc, B_is_char_device)
4654

4755
if ismember(B_is_char_device, stdlib.Backend().select('is_char_device'))
4856
tc.verifyTrue(r, n)
57+
58+
tc.verifyTrue(stdlib.is_char_device(string(n), B_is_char_device))
4959
else
5060
tc.verifyEmpty(r)
5161
end
@@ -58,11 +68,10 @@ function test_is_char_device(tc, B_is_char_device)
5868
function Ps = init_val()
5969
Ps = {
6070
{pwd(), true}, ...
61-
{mfilename("fullpath") + ".m", true}, ...
62-
{fileparts(mfilename("fullpath")) + "/../Readme.md", true}, ...
71+
{[mfilename("fullpath"), '.m'], true}, ...
72+
{[fileparts(mfilename("fullpath")), '/../Readme.md'], true}, ...
6373
{tempname(), false}, ...
64-
{'', false}, ...
65-
{"", false}
74+
{'', false}
6675
};
6776
if ispc()
6877
% On Windows, the root of the system drive is considered to exist

test/TestExpanduser.m

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}, ...
2-
TestTags = {'R2018b', 'impure'}) ...
2+
TestTags = {'R2017b', 'impure'}) ...
33
TestExpanduser < matlab.unittest.TestCase
44

55
properties (TestParameter)
@@ -11,6 +11,10 @@
1111

1212
function test_expanduser(tc, p)
1313
tc.verifyEqual(stdlib.expanduser(p{1}), p{2})
14+
15+
ins = string(p{1});
16+
ref = string(p{2});
17+
tc.verifyEqual(stdlib.expanduser(ins), ref);
1418
end
1519

1620
end
@@ -26,13 +30,15 @@ function test_expanduser(tc, p)
2630
h = getenv("HOME");
2731
end
2832

29-
p = {{'', ''}, {"", ""}, ...
30-
{"~abc", "~abc"}, ...
33+
p = {
34+
{'', ''}, ...
35+
{'', ''}, ...
36+
{'~abc', '~abc'}, ...
3137
{'~', h}, ...
32-
{'~/', h},...
33-
{"~" + filesep(), string(h)}, ...
34-
{"~/c", h + "/c"}, ...
38+
{'~/', h}, ...
39+
{['~', filesep()], h}, ...
40+
{'~/c', [h, '/c']}, ...
3541
{'~//c', [h, '/c']}, ...
36-
{"~" + filesep() + "c", h + "/c"}};
42+
{['~', filesep(), 'c'], [h, '/c']}};
3743

3844
end

0 commit comments

Comments
 (0)