From b472eeba1446a02f4803558c697943902ea9dd4a Mon Sep 17 00:00:00 2001 From: Mate Pek Date: Tue, 6 Jun 2023 21:52:42 +0700 Subject: [PATCH] autorun pick fix --- CHANGELOG.md | 6 ++++++ README.md | 4 +--- src/framework/AbstractExecutable.ts | 11 +++++++++++ src/framework/AbstractTest.ts | 11 +++++++++++ src/main.ts | 9 ++++++--- 5 files changed, 35 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c69f262c..4cb8780c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 0b96abc0..8bef2bdb 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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) diff --git a/src/framework/AbstractExecutable.ts b/src/framework/AbstractExecutable.ts index 861216db..5515ee8d 100644 --- a/src/framework/AbstractExecutable.ts +++ b/src/framework/AbstractExecutable.ts @@ -85,6 +85,17 @@ export abstract class AbstractExecutable | 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, diff --git a/src/main.ts b/src/main.ts index 0cacb83d..56f60d80 100644 --- a/src/main.ts +++ b/src/main.ts @@ -175,9 +175,12 @@ export async function activate(context: vscode.ExtensionContext): Promise 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; + } } } }