Skip to content

Commit 0cb8d12

Browse files
committed
test lang more thorough
1 parent c4e2b31 commit 0cb8d12

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

+stdlib/python_home.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
pe = pyenv();
77
h = pe.Home;
88
catch
9-
h = '';
9+
h = string.empty;
1010
end
1111

1212
end

test/TestLang.m

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}, ...
2-
TestTags = {'R2019b'}) ...
1+
classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}) ...
32
TestLang < matlab.unittest.TestCase
43

54

6-
methods (Test, TestTags = {'python'})
5+
methods (Test, TestTags = {'R2020b', 'python'})
76

87
function test_has_python(tc)
98
tc.assumeTrue(stdlib.has_python())
@@ -13,26 +12,29 @@ function test_has_python(tc)
1312

1413
function test_python_home(tc)
1514
tc.assumeTrue(stdlib.has_python(), "Python not available")
16-
tc.verifyNotEmpty(stdlib.python_home())
15+
16+
r = stdlib.python_home();
17+
tc.verifyNotEmpty(r)
18+
tc.verifyClass(r, 'string')
1719
end
1820

1921
end
2022

2123

22-
methods (Test, TestTags = {'dotnet'})
24+
methods (Test, TestTags = {'R2022b', 'dotnet'})
2325

2426
function test_dotnet_home(tc)
2527
tc.assumeTrue(stdlib.has_dotnet(), ".NET not available")
2628
h = stdlib.dotnet_home();
2729

28-
if ~stdlib.matlabOlderThan('R2022b')
29-
tc.verifyGreaterThan(strlength(h), 0)
30-
end
30+
tc.verifyGreaterThan(strlength(h), 0)
3131
end
3232

33+
3334
function test_dotnet_version(tc)
3435
tc.assumeTrue(stdlib.has_dotnet())
3536
v = stdlib.dotnet_version();
37+
tc.verifyClass(v, 'char')
3638
tc.verifyTrue(stdlib.version_atleast(v, "4.0"), ".NET version should be greater than 4.0")
3739
end
3840

test_main.m

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
%% TEST_MAIN Run all tests
22
%
3-
% R2021a+ needed for over half of the tests
3+
% Matlab >= R2020a recommended
44

55
function test_main(context, sel)
66
arguments
@@ -26,7 +26,16 @@ function test_main(context, sel)
2626
if e.identifier ~= "MATLAB:InputParser:UnmatchedParameter"
2727
rethrow(e)
2828
end
29-
suite = testsuite(test_root, 'Tag', tags);
29+
30+
try
31+
suite = testsuite(test_root, 'Tag', tags);
32+
catch e
33+
if e.identifier == "MATLAB:expectedScalartext"
34+
suite = testsuite(test_root, 'Tag', "R2019b");
35+
else
36+
rethrow(e)
37+
end
38+
end
3039
end
3140

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

0 commit comments

Comments
 (0)