Skip to content

Commit e470034

Browse files
committed
more test cases
1 parent 34d1257 commit e470034

18 files changed

+69
-24
lines changed

+stdlib/with_suffix.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
suffix (1,1) string
1313
end
1414

15+
f = "";
1516

1617
r = stdlib.parent(p);
18+
if ~stdlib.len(r), return, end
19+
1720
s = stdlib.stem(p);
1821

1922
if stdlib.len(s) == 0

test/TestAbsolute.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ function test_absolute2arg(tc, p2)
2525
td = stdlib.posix(pwd());
2626
r = td + "/hi";
2727

28-
p = {{"", td}, {"hi", r}, {"./hi", td + "/./hi"}, {"../hi", td + "/../hi"}};
28+
p = {{"", td}, {"hi", r}, {"./hi", td + "/./hi"}, {"../hi", td + "/../hi"}, {"file:///", ""}};
2929
end
3030

3131
function p = init2arg()
3232
td = stdlib.posix(pwd());
3333
r = td + "/hi";
3434

35-
p = {{"", "", td}, {"", "hi", r}, {"hi", "", r}, {"there", "hi", td + "/hi/there"}};
35+
p = {{"", "", td}, {"", "hi", r}, {"hi", "", r}, {"there", "hi", td + "/hi/there"}, {"file:///", "file:///", ""}};
3636
end

test/TestCanonical.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
{"~/", stdlib.homedir()}, ...
99
{"~/..", stdlib.parent(stdlib.homedir())}, ...
1010
{mfilename("fullpath") + ".m/..", stdlib.parent(mfilename("fullpath"))}, ...
11-
{"~/not-exist/a/..", stdlib.homedir() + "/not-exist"}
11+
{"~/not-exist/a/..", stdlib.homedir() + "/not-exist"}, ...
12+
{"file:///", ""}
1213
};
1314
end
1415

test/TestFileImpure.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
properties(TestParameter)
44
p_is_writable = {{pwd(), true}, {"not-exists", false}, {"file:///", false}, {"", false}};
55

6-
p_expand = {{"", ""}, {"~abc", "~abc"}, {"~", stdlib.homedir()}, {"~/c", stdlib.homedir() + "/c"}, {'~/////c', stdlib.homedir() + "/c"}};
6+
p_expand = {{"", ""}, {"~abc", "~abc"}, {"~", stdlib.homedir()}, ...
7+
{"~/c", stdlib.homedir() + "/c"}, {'~/////c', stdlib.homedir() + "/c"}, ...
8+
{"file:///", ""}};
79

810
p_same = {...
911
{"","", false}, ...

test/TestFilePure.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ function test_root_name(tc, p)
3030
p = {{"", ""}, ...
3131
{"a/b", ""}, ...
3232
{"/etc", ""}, ...
33-
{"c:/etc", ""}};
33+
{"c:/etc", ""}, ...
34+
{"file:///", ""}, ...
35+
};
3436

3537
if ispc
3638
p{4}{2} = "c:";

test/TestFilename.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
{"/a/b/c", "c"}, ...
77
{"/a/b/c/", ""}, ...
88
{"a/b/c.txt", "c.txt"}, ...
9-
{"a/b/c.txt.gz", "c.txt.gz"}
9+
{"a/b/c.txt.gz", "c.txt.gz"}, ...
10+
{"file:///users", ""}, ...
1011
};
1112
end
1213

test/TestIsAbsolute.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ function test_is_absolute(tc, p)
1414

1515

1616
function p = init_is_absolute()
17-
p = {{"", false}, {"x", false}, {"x:", false}, {"x:/foo", false}, {"/foo", true}};
17+
p = {{"", false}, {"x", false}, {"x:", false}, {"x:/foo", false}, {"/foo", true}, ...
18+
{"file:///", false}};
1819
if ispc
1920
p{4}{2} = true;
2021
p{5}{2} = false;

test/TestJava.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
classdef TestJava < matlab.unittest.TestCase
22

33
properties (TestParameter)
4-
Ps = {".", tempname, "", "not-exist"}
4+
Ps = {".", tempname, "", "not-exist", "file:///"}
55
end
66

77
methods(TestClassSetup)

test/TestJoin.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
{"a/b", "c/d", "a/b/c/d"}, ...
1515
{"ab/cd", "/ef", "/ef"}, ...
1616
{stdlib.homedir(), "", stdlib.homedir()}, ...
17-
{matlabroot, "bin", stdlib.posix(matlabroot + "/bin")}
17+
{matlabroot, "bin", stdlib.posix(matlabroot + "/bin")}, ...
18+
{"file:///", "file:///", ""}, ...
1819
}
1920
end
2021

test/TestNormalize.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ function test_normalize(tc, p)
3131
{"a.", "a."}, ...
3232
{"a..", "a.."}, ...
3333
{"./a/.", "a"}, ...
34-
{"../a", "../a"}
34+
{"../a", "../a"}, ...
35+
{"file:///", ""}
3536
};
3637

3738
if ispc

0 commit comments

Comments
 (0)