Skip to content

Commit a69e172

Browse files
committed
stem, with_suffix: no input coerce
1 parent a234d1e commit a69e172

File tree

6 files changed

+12
-21
lines changed

6 files changed

+12
-21
lines changed

+stdlib/set_modtime.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
function ok = set_modtime(p, t)
55
arguments
6-
p (1,1) string
6+
p {mustBeTextScalar}
77
t (1,1) datetime
88
end
99

+stdlib/stem.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
function st = stem(p)
44
arguments
5-
p (1,1) string
5+
p {mustBeTextScalar}
66
end
77

88
[~, n, s] = fileparts(p);

+stdlib/unlink.m

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,12 @@
22
% optional: mex
33
%
44
% Matlab or GNU Octave delete() has trouble with not being able to delete
5-
% open files on Windows. This MEX function overcomes that limitation.
6-
% This function returns a boolean success status, which
7-
% delete() does not.
8-
%
9-
%%% Inputs
10-
% * path (1,1) string
11-
%%% Outputs
12-
% * ok (1,1) logical
13-
%
14-
% This function is written in C++ using STL <filesystem>
5+
% open files on Windows. This function overcomes that limitation by returning
6+
% a boolean success status.
157

168
function ok = unlink(apath)
179
arguments
18-
apath (1,1) string
10+
apath {mustBeTextScalar}
1911
end
2012

2113
%% fallback for if MEX not compiled

+stdlib/with_suffix.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
function f = with_suffix(p, suffix)
1010
arguments
11-
p (1,1) string
12-
suffix (1,1) string
11+
p {mustBeTextScalar}
12+
suffix {mustBeTextScalar}
1313
end
1414

1515
f = "";
@@ -27,7 +27,7 @@
2727
if strcmp(r, '.')
2828
f = s;
2929
else
30-
f = strcat(r, "/", s);
30+
f = strcat(r, '/', s);
3131
end
3232

3333
f = strcat(f, suffix);

test/TestStem.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{"a/b/c/", ""}, ...
99
{"a/b/c.txt", "c"}, ...
1010
{"a/b/c.txt.gz", "c.txt"}, ...
11-
{"a/b/.c", ".c"}, ...
11+
{'a/b/.c', '.c'}, ...
1212
{"", ""}
1313
}
1414

test/TestWithSuffix.m

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
properties (TestParameter)
44
p = {{"foo.h5", ".nc", "foo.nc"},...
5-
{"c", "", "c"}, ...
6-
{"c.nc", "", "c"}, ...
5+
{"c", "", "c"}, ...
6+
{"c.nc", "", "c"}, ...
77
{"", ".nc", ".nc"}, ...
88
{"a/b/c/", ".h5", "a/b/c/.h5"}, ...
99
{"a/b/.h5", ".nc", "a/b/.h5.nc"}, ...
10-
{"a/b", ".nc", "a/b.nc"}
11-
};
10+
{'a/b', '.nc', "a/b.nc"}};
1211
end
1312

1413
methods (Test)

0 commit comments

Comments
 (0)