Skip to content

Commit

Permalink
autorun pick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
matepek committed Jun 6, 2023
1 parent 4473af2 commit b472eeb
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

## [4.4.3]

### Fixed

- issue related to autorun feature. It was not picking up some level of tests. [related](https://github.com/matepek/vscode-catch2-test-adapter/issues/387).

## [4.4.2] - 2023-04-28

Improved .env file parser
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ It also have basic support for [Google Benchmark](https://github.com/google/benc
- Runs executables parallel (_testMate.cpp.test.parallelExecutionLimit_).
- Sorts tests and suites (_testExplorer.sort_).
- Supports popular **debuggers** such as `vadimcn.vscode-lldb`, `webfreak.debug` and `ms-vscode.cpptools` out of the box.
- Retire tests and "Autorun" them. (Coming soon..)
- Retire tests and "Autorun" them.

### Screenshots

Expand Down Expand Up @@ -87,8 +87,6 @@ Plenty of more **fine-tuning options** are available under [test.advancedExecuta
| `testMate.cmd.reload-workspaces` | Force reload workspaces (clean slate) |
| `testing.refreshTests` | Force reload workspaces (clean slate) |

## About [Sentry.io](https://github.com/matepek/vscode-catch2-test-adapter/blob/master/documents/configuration/log.logSentry.md) integration

## [License](https://github.com/matepek/vscode-catch2-test-adapter/blob/master/LICENSE)

## [Support](https://github.com/matepek/vscode-catch2-test-adapter/blob/master/documents/support.md)
Expand Down
11 changes: 11 additions & 0 deletions src/framework/AbstractExecutable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@ export abstract class AbstractExecutable<TestT extends AbstractTest = AbstractTe
return this._tests.values();
}

public hasTestWithId(id: string): boolean {
if (this._execItem.getItem()?.id === id) return true;
const found = this._tests.get(id);
if (found) return true;
for (const test of this._tests.values()) {
const found = test.hasSubTest(id);
if (found) return true;
}
return false;
}

private async _getOrCreateChildGroup(
idIn: string | undefined,
label: string,
Expand Down
11 changes: 11 additions & 0 deletions src/framework/AbstractTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,17 @@ export abstract class AbstractTest {

private _subTests: Map<string /*id*/, SubTest> | undefined = undefined;

public hasSubTest(id: string): boolean {
if (this._subTests === undefined) return false;
const found = this._subTests.get(id);
if (found !== undefined) return true;
for (const subTest of this._subTests.values()) {
const found = subTest.hasSubTest(id);
if (found) return true;
}
return false;
}

async getOrCreateSubTest(
id: string,
label: string | undefined,
Expand Down
9 changes: 6 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,12 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
else for (const t of e.getTests()) include.push(t.item);
}
} else {
for (const e of executables) {
for (const t of e.getTests()) {
if (request.include.indexOf(t.item) !== -1) include.push(t.item);
for (const item of request.include) {
for (const e of executables) {
if (e.hasTestWithId(item.id)) {
include.push(item);
break;
}
}
}
}
Expand Down

0 comments on commit b472eeb

Please sign in to comment.