Skip to content

Commit 34de6f4

Browse files
committed
test:simplify
1 parent fe56b91 commit 34de6f4

File tree

6 files changed

+31
-45
lines changed

6 files changed

+31
-45
lines changed

test/TestExists.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function test_is_char_device(tc, B_is_char_device)
7272
methods (Test, TestTags={'R2025a'})
7373

7474
function test_is_readable_array(tc)
75-
tc.assumeFalse(stdlib.matlabOlderThan('R2025a'))
75+
tc.assumeFalse(isMATLABReleaseOlderThan('R2025a'))
7676
in = [".", tempname(), mfilename('fullpath') + ".m"];
7777
out = [true, false, true];
7878

@@ -82,7 +82,7 @@ function test_is_readable_array(tc)
8282

8383

8484
function test_is_writable_array(tc)
85-
tc.assumeFalse(stdlib.matlabOlderThan('R2025a'))
85+
tc.assumeFalse(isMATLABReleaseOlderThan('R2025a'))
8686
in = [".", tempname(), mfilename('fullpath') + ".m"];
8787
out = [true, false, true];
8888

test/TestFilename.m

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
properties (TestParameter)
66
p
7-
backend
7+
backend = {'regexp', 'pattern'}
88
end
99

1010

@@ -24,16 +24,6 @@
2424
p{end+1} = {"c:/df\df.txt", "df.txt"};
2525
end
2626
end
27-
28-
function backend = init_backend()
29-
backend = {'regexp'};
30-
31-
try %#ok<TRYNC>
32-
if ~isMATLABReleaseOlderThan('R2020b')
33-
backend{end+1} = 'pattern';
34-
end
35-
end
36-
end
3727
end
3828

3929

test/TestIsExe.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function test_is_executable_binary(tc, peb)
6161

6262
methods (Test, TestTags={'R2025a'})
6363
function test_is_exe_array(tc)
64-
tc.assumeFalse(stdlib.matlabOlderThan('R2025a'))
64+
tc.assumeFalse(isMATLABReleaseOlderThan('R2025a'))
6565
n = fullfile(matlabroot, "bin/matlab");
6666
if ispc()
6767
n = n + ".exe";

test/TestParent.m

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,12 @@
11
classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture("..")}, ...
2-
TestTags = {'R2019b', 'pure'}) ...
2+
TestTags = {'R2021a', 'pure'}) ...
33
TestParent < matlab.unittest.TestCase
44

55
properties (TestParameter)
6-
p = init_parent()
6+
p
77
end
88

9-
10-
methods (Test, TestTags=["R2019b", "pure"])
11-
12-
function test_parent(tc, p)
13-
pr = stdlib.parent(p{1});
14-
tc.verifyEqual(pr, p{2}, sprintf("parent(%s)", p{1}))
15-
end
16-
17-
end
18-
19-
20-
methods (Test, TestTags=["R2020b", "pure"])
21-
22-
function test_parent_array(tc)
23-
tc.assumeFalse(stdlib.matlabOlderThan('R2020b'))
24-
25-
in = ["", ".", "..", "../..", "a/", "a/b", "ab/.parent", "ab/.parent.txt", "a/b/../.parent.txt"];
26-
exp = [".", ".", ".", "..", ".", "a", "ab", "ab", "a/b/.."];
27-
28-
out = stdlib.parent(in);
29-
tc.verifyEqual(out, exp)
30-
end
31-
32-
end
33-
end
34-
35-
9+
methods (TestParameterDefinition, Static)
3610
function p = init_parent()
3711

3812
p = {
@@ -59,3 +33,25 @@ function test_parent_array(tc)
5933
p{end+1} = {'a//b', "a"};
6034

6135
end
36+
end
37+
38+
39+
methods (Test, TestTags=["pure"])
40+
41+
function test_parent(tc, p)
42+
pr = stdlib.parent(p{1});
43+
tc.verifyEqual(pr, p{2}, sprintf("parent(%s)", p{1}))
44+
end
45+
46+
47+
function test_parent_array(tc)
48+
49+
in = ["", ".", "..", "../..", "a/", "a/b", "ab/.parent", "ab/.parent.txt", "a/b/../.parent.txt"];
50+
exp = [".", ".", ".", "..", ".", "a", "ab", "ab", "a/b/.."];
51+
52+
out = stdlib.parent(in);
53+
tc.verifyEqual(out, exp)
54+
end
55+
56+
end
57+
end

test/TestPermissions.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function test_set_permissions_noread(tc)
8484

8585
% This ONLY works with the new setPermissions.
8686
% fileattrib can not even set the permissions on Linux.
87-
tc.assumeFalse(stdlib.matlabOlderThan('R2025a'))
87+
tc.assumeFalse(isMATLABReleaseOlderThan('R2025a'))
8888

8989
nr = fullfile(pwd(), "no-read");
9090

test/TestResolve.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function test_resolve_fullpath(tc, p)
5959

6060
methods (Test, TestTags={'R2024a'})
6161
function test_resolve_array(tc)
62-
tc.assumeFalse(stdlib.matlabOlderThan('R2024a'))
62+
tc.assumeFalse(isMATLABReleaseOlderThan('R2024a'))
6363

6464
in = ["", "hi", "/ok", "not-exist/a/.."];
6565
c = stdlib.resolve(in, false);

0 commit comments

Comments
 (0)