Skip to content

Commit e5e8998

Browse files
committed
fix test
1 parent 0d63cbd commit e5e8998

6 files changed

Lines changed: 41 additions & 21 deletions

sample/TheTruth.m

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,5 @@ function testTheTestOfAllTime(testCase)
44
onetyone = 11;
55
testCase.verifyEqual(onetyone, 11);
66
end
7-
8-
function testAssumptionFailure(testCase)
9-
testCase.assumeEqual(1+1, 11);
10-
end
11-
12-
function testVerificationFailure(testCase)
13-
% Two verifications to show that the test continues after a verification failure
14-
testCase.verifyEqual(1+1, 11);
15-
testCase.verifyEqual(1+1, 11);
16-
end
17-
18-
function testAssertionFailure(testCase)
19-
% Two assertions to show that the test ends after an assertion failure
20-
testCase.assertEqual(1+1, 11);
21-
testCase.assertEqual(1+1, 11);
22-
end
237
end
248
end

sample/tAssumptionFailure.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
classdef tAssumptionFailure < matlab.unittest.TestCase
2+
methods (Test)
3+
function testAssumptionFailure(testCase)
4+
testCase.assumeEqual(1+1, 11);
5+
end
6+
end
7+
end
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
% Named ValidationTest to run at the end of the suite
2-
% because it contains a fatal assertion failure.
3-
classdef ValidationTest < matlab.unittest.TestCase
1+
classdef tFatalAssertionFailure < matlab.unittest.TestCase
42
methods (Test)
53
function testFatalAssertionFailure(testCase)
64
testCase.fatalAssertEqual(1+1, 11);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
classdef tVerificationAndAssertionFailure < matlab.unittest.TestCase
2+
methods (Test)
3+
function testVerificationFailure(testCase)
4+
% Two verifications to show that the test continues after a verification failure
5+
testCase.verifyEqual(1+1, 11);
6+
testCase.verifyEqual(1+1, 11);
7+
end
8+
9+
function testAssertionFailure(testCase)
10+
% Two assertions to show that the test ends after an assertion failure
11+
testCase.assertEqual(1+1, 11);
12+
testCase.assertEqual(1+1, 11);
13+
end
14+
end
15+
end

src/testResultsSummary.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ interface TestResultsData {
4848
export function writeSummary(testResults: MatlabTestFile[][], stats: TestStatistics) {
4949
try {
5050
const helpLink = `<a href="https://github.com/matlab-actions/run-tests/blob/main/README.md"` +
51-
`target="_blank" title="View documentation">ℹ️</a>`;
51+
` target="_blank" title="View documentation">ℹ️</a>`;
5252
const header = getTestHeader(testResults, stats);
5353
const detailedResults = getDetailedResults(testResults);
5454

src/testResultsSummary.unit.test.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,24 @@ describe('Artifact Processing Tests', () => {
138138
testResultsSummary.writeSummary(testResults, stats);
139139

140140
expect(core.summary.addHeading).toHaveBeenCalledTimes(2);
141-
expect(core.summary.addHeading).toHaveBeenNthCalledWith(1, 'MATLAB Test Results (' + process.env.GITHUB_ACTION + ')');
141+
expect(core.summary.addHeading).toHaveBeenNthCalledWith(
142+
1,
143+
expect.stringContaining('MATLAB Test Results')
144+
);
145+
expect(core.summary.addHeading).toHaveBeenNthCalledWith(
146+
1,
147+
expect.stringContaining('<a href="https://github.com/matlab-actions/run-tests/blob/main/README.md"')
148+
);
149+
expect(core.summary.addHeading).toHaveBeenNthCalledWith(
150+
1,
151+
expect.stringContaining('target="_blank"')
152+
);
153+
expect(core.summary.addHeading).toHaveBeenNthCalledWith(
154+
1,
155+
expect.stringContaining('ℹ️</a>')
156+
);
142157
expect(core.summary.addHeading).toHaveBeenNthCalledWith(2, 'All tests', 3);
158+
143159
expect(core.summary.addRaw).toHaveBeenCalledTimes(2);
144160
expect(core.summary.write).toHaveBeenCalledTimes(1);
145161
});

0 commit comments

Comments
 (0)