Skip to content

Commit 836e514

Browse files
committed
testSymlink < R2021a
1 parent a378fb7 commit 836e514

File tree

2 files changed

+27
-21
lines changed

2 files changed

+27
-21
lines changed

+stdlib/+dotnet/private/dotnetException.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function dotnetException(e)
77
% pass
88
case {'MATLAB:undefinedVarOrClass', 'MATLAB:NET:NETInterfaceUnsupported'}
99
% .NET not enabled
10-
case 'MATLAB:subscripting:classHasNoPropertyOrMethod'
10+
case {'MATLAB:NET:INVALIDMEMBER', 'MATLAB:subscripting:classHasNoPropertyOrMethod'}
1111
% .NET too old or not supported on this platform
1212
otherwise
1313
rethrow(e)

test/TestSymlink.m

Lines changed: 26 additions & 20 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 = {'R2021a', 'symlink', 'impure'}) ...
2+
TestTags = {'R2019b', 'symlink', 'impure'}) ...
33
TestSymlink < matlab.unittest.TestCase
44

55
properties
@@ -12,18 +12,8 @@
1212
{mfilename("fullpath") + ".m", false}, ...
1313
{"", false}};
1414
Pre = {'', "", tempname()}
15-
B_create_symlink
16-
B_read_symlink
17-
B_is_symlink
18-
end
19-
20-
21-
methods (TestParameterDefinition, Static)
22-
function [B_create_symlink, B_read_symlink, B_is_symlink] = setupBackends()
23-
B_create_symlink = init_backend("create_symlink");
24-
B_read_symlink = init_backend("read_symlink");
25-
B_is_symlink = init_backend("is_symlink");
26-
end
15+
B_create_symlink = {'native', 'dotnet', 'python', 'sys'}
16+
B_is_symlink = {'native', 'java', 'python', 'dotnet', 'sys'}
2717
end
2818

2919

@@ -50,24 +40,34 @@ function test_is_symlink(tc, p, B_is_symlink)
5040
[i, b] = stdlib.is_symlink(tc.link, B_is_symlink);
5141

5242
tc.assertEqual(char(b), B_is_symlink)
43+
44+
if ismember(B_is_symlink, stdlib.Backend().select('is_symlink'))
5345
tc.assertTrue(i, "failed to detect own link " + tc.link)
5446

5547
tc.verifyEqual(stdlib.is_symlink(p{1}, B_is_symlink), p{2}, p{1})
48+
else
49+
tc.verifyEmpty(i)
50+
end
5651
end
5752

5853

59-
function test_read_symlink_empty(tc, Pre, B_read_symlink)
60-
[r, b] = stdlib.read_symlink(Pre, B_read_symlink);
61-
tc.assertEqual(char(b), B_read_symlink)
54+
function test_read_symlink_empty(tc, Pre, B_is_symlink)
55+
[r, b] = stdlib.read_symlink(Pre, B_is_symlink);
56+
tc.assertEqual(char(b), B_is_symlink)
6257

6358
tc.verifyEqual(r, string.empty)
6459
end
6560

6661

67-
function test_read_symlink(tc, B_read_symlink)
68-
r = stdlib.read_symlink(tc.link, B_read_symlink);
62+
function test_read_symlink(tc, B_is_symlink)
63+
r = stdlib.read_symlink(tc.link, B_is_symlink);
6964
tc.verifyClass(r, 'string')
70-
tc.verifyEqual(r, string(tc.target))
65+
66+
if ismember(B_is_symlink, stdlib.Backend().select('read_symlink'))
67+
tc.verifyEqual(r, string(tc.target))
68+
else
69+
tc.verifyEmpty(r)
70+
end
7171
end
7272

7373

@@ -89,7 +89,13 @@ function test_create_symlink(tc, B_create_symlink)
8989
tc.assertThat(ano, ~matlab.unittest.constraints.IsFile)
9090
tc.assertFalse(stdlib.is_symlink(ano))
9191

92-
tc.verifyEqual(h(tc.target, ano, B_create_symlink), exp)
92+
r = h(tc.target, ano, B_create_symlink);
93+
94+
if ismember(B_create_symlink, stdlib.Backend().select('create_symlink'))
95+
tc.verifyEqual(r, exp)
96+
else
97+
tc.verifyEmpty(r)
98+
end
9399
end
94100

95101
end

0 commit comments

Comments
 (0)