Skip to content

Commit de7d8ce

Browse files
committed
Merge remote-tracking branch 'home/master'
2 parents 550e07a + 2d2d7b2 commit de7d8ce

File tree

6 files changed

+57
-8
lines changed

6 files changed

+57
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77
## [Unreleased]
88

9+
## [3.7.0] - 2021-08-21
10+
11+
Feature Added: CppUTest Framework Support with tests
12+
913
## [3.6.27] - 2021-08-09
1014

1115
NPM update

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
# C++ TestMate
22

3-
## A **Catch2**, **GoogleTest**, **doctest** and **GoogleBenchmark** Explorer for VSCode
3+
## A **Catch2**, **GoogleTest**, **CppUTest**, **doctest** and **GoogleBenchmark** Explorer for VSCode
44

55
[![Visual Studio Marketplace](https://img.shields.io/vscode-marketplace/v/matepek.vscode-catch2-test-adapter.svg)](https://marketplace.visualstudio.com/items?itemName=matepek.vscode-catch2-test-adapter)
66
[![GitHub issues](https://img.shields.io/github/issues/matepek/vscode-catch2-test-adapter?color=green)](https://github.com/matepek/vscode-catch2-test-adapter/issues)
77
[![Visual Studio Marketplace](https://img.shields.io/vscode-marketplace/d/matepek.vscode-catch2-test-adapter.svg)](https://marketplace.visualstudio.com/items?itemName=matepek.vscode-catch2-test-adapter)
88
[![Gitter](https://badges.gitter.im/CppTestMate/community.svg)](https://gitter.im/CppTestMate/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
99

1010
This extension allows you to run your [Catch2](https://github.com/catchorg/Catch2),
11-
[Google Test](https://github.com/google/googletest)
12-
and [DOCtest](https://github.com/onqtam/doctest)
11+
[Google Test](https://github.com/google/googletest), [CppUTest](https://github.com/cpputest/cpputest) and [DOCtest](https://github.com/onqtam/doctest)
1312
tests using the [Test Explorer for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-test-explorer).
1413
It also have basic support for [Google Benchmark](https://github.com/google/benchmark).
1514

documents/configuration/test.advancedExecutables.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ If it is an object it can contains the following properties:
6464
| `gtest` | Object with framework specific settings. [Detail](https://github.com/matepek/vscode-catch2-test-adapter/blob/master/documents/configuration/test.advancedExecutables.md#framework-specific-settings) |
6565
| `doctest` | Object with framework specific settings. [Detail](https://github.com/matepek/vscode-catch2-test-adapter/blob/master/documents/configuration/test.advancedExecutables.md#framework-specific-settings) |
6666
| `gbenchmark` | Object with framework specific settings. [Detail](https://github.com/matepek/vscode-catch2-test-adapter/blob/master/documents/configuration/test.advancedExecutables.md#framework-specific-settings) |
67+
| `cpputest` | Object with framework specific settings. [Detail](https://github.com/matepek/vscode-catch2-test-adapter/blob/master/documents/configuration/test.advancedExecutables.md#framework-specific-settings) |
6768

6869
The `pattern` (or the `executables` used as string or an array of strings)
6970
can contain [_search-pattern_](https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options).
@@ -246,6 +247,10 @@ For example:
246247

247248
- `Catch v2.11.1` + `/Catch v(\d+)\.(\d+)\.(\d+)\s?/` -> `[2, 11, 1]`
248249

250+
In case of `cpputest` the helpRegex can be as following.
251+
252+
- `[-g|sg|xg|xsg groupName]... [-n|sn|xn|xsn testName]...`
253+
249254
### ignoreTestEnumerationStdErr
250255

251256
As the name says test enumeraton will ignore std::err output.

src/framework/CppUTestRunnable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class CppUTestRunnable extends AbstractRunnable {
2424
}
2525

2626
private getTestGrouping(): TestGrouping {
27-
// TODO: Reconsider grouping
27+
// TODO: Consider grouping based on passed/failed
2828
if (this.properties.testGrouping) {
2929
return this.properties.testGrouping;
3030
} else {

src/framework/CppUTestTest.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ export class CppUTestTest extends AbstractTest {
8989
if (lines.length > 1 && failedTest !== null) {
9090
const filePath = failedTest[2].split('/').pop();
9191
const lineNumber = Number(failedTest[3]) - 1;
92-
eventBuilder.appendDecorator(filePath, lineNumber, [lines[3], lines[4]]);
92+
const expected = lines.find(value => /^\texpected/.test(value));
93+
const actual = lines.find(value => /^\tbut was/.test(value));
94+
eventBuilder.appendDecorator(filePath, lineNumber, [expected ? expected : '', actual ? actual : '']);
9395
}
9496

9597
const event = eventBuilder.build(output.replace(/\): error: /g, '): error: \n'));

test/framework/CppUTestTest.test.ts

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ describe(path.basename(__filename), function () {
2525
'TEST(UtestShell, PassedCheckEqualWillIncreaseTheAmountOfChecks)',
2626
'/workspaces/cpputest-4.0/tests/CppUTest/UtestTest.cpp:90: error: Failure in TEST(UtestShell, PassedCheckEqualWillIncreaseTheAmountOfChecks)',
2727
'LONGS_EQUAL(10, fixture.getCheckCount()) failed',
28-
'expected <10 (0xa)>',
29-
'but was < 1 (0x1)>',
28+
'\texpected <10 (0xa)>',
29+
'\tbut was < 1 (0x1)>',
3030
' - 47 ms',
3131
].join(EOL);
3232

@@ -43,7 +43,7 @@ describe(path.basename(__filename), function () {
4343
decorations: [
4444
{
4545
file: 'UtestTest.cpp',
46-
hover: 'expected <10 (0xa)>\nbut was < 1 (0x1)>',
46+
hover: '\texpected <10 (0xa)>\n\tbut was < 1 (0x1)>',
4747
line: 89,
4848
message: '⬅ expected <10 (0xa)>; but was < 1 (0x1)>',
4949
},
@@ -57,6 +57,45 @@ describe(path.basename(__filename), function () {
5757
assert.deepStrictEqual(cpputest.lastRunEvent, expected);
5858
});
5959

60+
it('parses another failed test', function () {
61+
const output = [
62+
'TEST(read_rssi, min_rssi_with_min_gain)',
63+
'/workspaces/cpputest-4.0/tests/CppUTest/test_read_rssi.cpp:176: error: Failure in TEST(read_rssi, min_rssi_with_min_gain)',
64+
'\texpected <-1984>',
65+
'\tbut was <-1987>',
66+
'difference starts at position 4 at: < -1987 >',
67+
' ^',
68+
'',
69+
'- 47 ms',
70+
].join(EOL);
71+
72+
const ev = cpputest.parseAndProcessTestCase('runid', output, 42, null, '');
73+
74+
const expected: TestRunEvent = {
75+
testRunId: 'runid',
76+
type: 'test',
77+
test: cpputest.id,
78+
message: output,
79+
state: 'failed',
80+
description: '(47ms)',
81+
tooltip: 'Name: TestCase.TestName\n⏱Duration: 47ms',
82+
decorations: [
83+
{
84+
file: 'test_read_rssi.cpp',
85+
hover: '\texpected <-1984>\n\tbut was <-1987>',
86+
line: 175,
87+
message: '⬅ expected <-1984>; but was <-1987>',
88+
},
89+
],
90+
};
91+
92+
assert.strictEqual(cpputest.description, ev.description);
93+
assert.strictEqual(cpputest.tooltip, ev.tooltip);
94+
assert.strictEqual(cpputest.lastRunMilisec, 47);
95+
assert.deepStrictEqual(ev, expected);
96+
assert.deepStrictEqual(cpputest.lastRunEvent, expected);
97+
});
98+
6099
it('parses passed test', function () {
61100
const output = ['TEST(UtestShell, compareDoubles) - 30 ms'].join(EOL);
62101

0 commit comments

Comments
 (0)