Skip to content

Commit 9b44e1b

Browse files
committed
matlab < R2020b compatibility: string array
1 parent 63db420 commit 9b44e1b

File tree

7 files changed

+17
-13
lines changed

7 files changed

+17
-13
lines changed

+stdlib/+python/is_mount.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
if ~p.exists(), return, end
1414

1515
% some Python on CI needs this. Didn't replicate on local Windows PC.
16-
if ispc() && strcmp(filepath, string(p.drive)) && ~endsWith(filepath, "/" | filesep)
16+
if ispc() && strcmp(filepath, string(p.drive)) && ~endsWith(filepath, ["/", filesep])
1717
y = false;
1818
return
1919
end

+stdlib/+sys/is_mount.m

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

1010
if ispc()
1111
if ismember(filepath, ["/", "\"]) || ...
12-
(endsWith(filepath, "/" | filesep) && isfolder(filepath) && filepath == stdlib.root(filepath))
12+
(endsWith(filepath, ["/", filesep]) && isfolder(filepath) && filepath == stdlib.root(filepath))
1313
y = true;
1414
return
1515
end

+stdlib/join.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
elseif ~stdlib.strempty(rdo)
1818

1919
if ~stdlib.strempty(rnb)
20-
if endsWith(rnb, "/" | filesep)
20+
if endsWith(rnb, ["/", filesep])
2121
p = rnb + other;
2222
else
2323
p = rnb + "/" + other;
@@ -29,7 +29,7 @@
2929
elseif ~stdlib.strempty(base)
3030

3131
if ~stdlib.strempty(other)
32-
if endsWith(base, "/" | filesep)
32+
if endsWith(base, ["/", filesep])
3333
p = base + other;
3434
else
3535
p = base + "/" + other;

+stdlib/normalize.m

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

1616
parts = split(apath, ["/", filesep]);
1717
i0 = 1;
18-
if startsWith(apath, "/" | filesep)
18+
if startsWith(apath, ["/", filesep])
1919
n = extractBefore(apath, 2);
2020
elseif ispc() && strlength(apath) >= 2 && ~stdlib.strempty(stdlib.root_name(apath))
2121
n = parts(1);

+stdlib/root_dir.m

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

1616
r = repmat("", size(p));
1717

18-
i = startsWith(p, "/" | filesep);
18+
i = startsWith(p, ["/", filesep]);
1919
r(i) = extractBefore(p(i), 2);
2020

2121
if ispc()

+stdlib/which.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
for p = fpath
4545
if stdlib.strempty(p), continue, end
4646

47-
if endsWith(p, "/" | filesep)
47+
if endsWith(p, ["/", filesep])
4848
e = p + cmd;
4949
else
5050
e = p + "/" + cmd;

test_main.m

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
%% TEST_MAIN Run all tests
2+
%
3+
% R2021a+ needed for over half of the tests
4+
15
function test_main(context, sel)
26
arguments
37
context = []
@@ -7,9 +11,6 @@ function test_main(context, sel)
711
import matlab.unittest.TestRunner
812
import matlab.unittest.selectors.HasTag
913

10-
assert(~isMATLABReleaseOlderThan('R2020b'))
11-
% R2021a+ needed for over half of the tests
12-
1314
if isempty(context)
1415
cwd = fileparts(mfilename('fullpath'));
1516
else
@@ -19,10 +20,13 @@ function test_main(context, sel)
1920

2021
tags = ["native_exe", releaseTestTags()];
2122

22-
if isMATLABReleaseOlderThan('R2022b')
23-
suite = testsuite(test_root, 'Tag', tags);
24-
else
23+
try
2524
suite = testsuite(test_root, 'Tag', tags, 'InvalidFileFoundAction', "error");
25+
catch e
26+
if e.identifier ~= "MATLAB:InputParser:UnmatchedParameter"
27+
rethrow(e)
28+
end
29+
suite = testsuite(test_root, 'Tag', tags);
2630
end
2731

2832
% selectIf takes the subset of suite tests that meet "sel" conditions

0 commit comments

Comments
 (0)