|
18 | 18 | dir(fullfile(sw_rootdir, 'tutorials', 'publish', 'tutorial*.m')),... |
19 | 19 | 'UniformOutput', false); |
20 | 20 | % Incase we need to debug one tutorial. |
21 | | -% testFun = {fullfile(sw_rootdir, 'tutorials', 'publish', 'tutorial38.m')}; |
| 21 | +% testFun = {fullfile(sw_rootdir, 'tutorials', 'publish', 'tutorial9.m')}; |
22 | 22 |
|
23 | 23 | end |
24 | 24 |
|
25 | 25 | methods (TestMethodSetup) |
26 | 26 | function prepareForRun(testCase) |
| 27 | + |
27 | 28 | close all |
28 | 29 | clc |
29 | 30 |
|
@@ -68,11 +69,24 @@ function testFunction(testCase, testFun) |
68 | 69 | break |
69 | 70 | end |
70 | 71 | try |
71 | | - dat = webread(strtok(url,''')')); |
| 72 | + [~] = webread(strtok(url,''')')); |
72 | 73 | catch ME |
73 | | - warning('WARNING! Remote content not found for tutorial %s', testFun); |
| 74 | + ident = ''; |
| 75 | + switch ME.identifier |
| 76 | + case 'MATLAB:webservices:HTTP404StatusCodeError' |
| 77 | + warning('WARNING! Remote content not found for tutorial %s', testFun); |
| 78 | + ident = 'MATLAB:webservices:HTTP404StatusCodeError'; |
| 79 | + case 'MATLAB:webservices:UnknownHost' |
| 80 | + warning('WARNING! Can not find remote content. DNS problem?') |
| 81 | + ident = 'MATLAB:webservices:UnknownHost'; |
| 82 | + case 'MATLAB:webservices:Timeout' |
| 83 | + warning('WARNING! Can not connect to the internet.') |
| 84 | + ident = 'MATLAB:webservices:Timeout'; |
| 85 | + otherwise |
| 86 | + rethrow(ME) |
| 87 | + end |
74 | 88 | import matlab.unittest.constraints.Matches |
75 | | -% testCase.verifyMatches(ME.identifier, 'MATLAB:webservices:HTTP404StatusCodeError'); |
| 89 | + testCase.verifyMatches(ME.identifier, ident); |
76 | 90 | return |
77 | 91 | end |
78 | 92 | end |
|
0 commit comments