Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,16 @@
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"todo-tree.general.tags": ["BUG", "HACK", "FIXME", "TODO", "TODO:future", "TODO:nice", "TODO:release", "XXX"],
"todo-tree.general.tags": [
"BUG",
"HACK",
"FIXME",
"TODO",
"TODO:future",
"TODO:nice",
"TODO:release",
"XXX"
],
"todo-tree.highlights.customHighlight": {
"TODO:future": {
"type": "none"
Expand All @@ -138,5 +147,7 @@
"**/bower_components": true,
"**/*.code-search": true,
"/package-lock.json": true
}
}
},
"cmake.sourceDirectory": "/Users/matepek/repo/vscode-catch2-test-adapter/test/cpp",
"testMate.cpp.test.executables": "test/cpp/build/**/*{test,Test,TEST}*"
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions src/TestItemManager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as vscode from 'vscode';
import { AbstractTest } from './framework/AbstractTest';
import { parseLine } from './Util';
import { AbstractExecutable } from './framework/AbstractExecutable';

///

Expand Down Expand Up @@ -110,4 +111,15 @@ export class TestItemManager {
}
}
}

// maps only if the TestItem explicitly represents the executable. relates to groupByExecuable
private readonly testItem2ExecDirectly = new WeakMap<vscode.TestItem, AbstractExecutable>();

setDirectExec(item: vscode.TestItem, exec: AbstractExecutable): void {
this.testItem2ExecDirectly.set(item, exec);
}

getDirectExec(item: vscode.TestItem): AbstractExecutable | undefined {
return this.testItem2ExecDirectly.get(item);
}
}
8 changes: 8 additions & 0 deletions src/WorkspaceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,14 @@ export class WorkspaceManager implements vscode.Disposable {
});
});

vscode.debug.onDidReceiveDebugSessionCustomEvent((_e: vscode.DebugSessionCustomEvent) => {
this._shared.log.info('TODO');
});

vscode.debug.onDidChangeActiveDebugSession((_e: vscode.DebugSession | undefined) => {
this._shared.log.info('TODO');
});

const terminated = new Promise<void>(resolve => {
vscode.debug.onDidTerminateDebugSession((session: vscode.DebugSession) => {
const session2 = session as unknown as { configuration: { [prop: string]: string } };
Expand Down
4 changes: 3 additions & 1 deletion src/framework/AbstractExecutable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ export abstract class AbstractExecutable<TestT extends AbstractTest = AbstractTe

// special item handling for exec
this._execItem.setItem(itemOfLevel);
this.shared.testController.setDirectExec(itemOfLevel, this);
},
groupBySource: async (g: GroupBySource): Promise<void> => {
this._updateVarsWithTags(g, tags, tagsResolveRule);
Expand Down Expand Up @@ -630,7 +631,7 @@ export abstract class AbstractExecutable<TestT extends AbstractTest = AbstractTe
} else testsToRunFinal.push(t);
}

if (testsToRunFinal.length == 0) return;
if (testsToRunFinal.length == 0 && !testsToRun.implicitAll) return;

try {
await this.runTasks('beforeEach', taskPool, testRun.token);
Expand Down Expand Up @@ -1014,6 +1015,7 @@ class ExecutableGroup {
export class TestsToRun {
readonly direct: AbstractTest[] = []; // test is drectly included, should be run even if it is skipped
readonly parent: AbstractTest[] = []; // tests included because one of the ascendant was directly included
implicitAll: boolean = false;

*[Symbol.iterator](): Iterator<AbstractTest> {
for (const i of this.direct) yield i;
Expand Down
4 changes: 4 additions & 0 deletions src/framework/SharedVarOfExec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export class SharedVarOfExec {
return this._frameworkSpecific.failIfExceedsLimitNs;
}

get enableRunExecutableTestsImplicitly(): boolean {
return true; //TODO
}

/// accessors for shared

readonly log = this.shared.log;
Expand Down
15 changes: 15 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
if (request.exclude?.includes(item)) return;

const test = testItemManager.map(item);
const directExec = test ? undefined : testItemManager.getDirectExec(item);

if (test) {
const executable = test.exec;
Expand All @@ -118,6 +119,20 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
executables.set(executable, tests);
}
tests[type].push(test);
} else if (directExec && directExec.shared.enableRunExecutableTestsImplicitly) {
const executable = directExec;
const manager = workspace2manager.get(executable.shared.workspaceFolder)!;
let executables = managers.get(manager);
if (!executables) {
executables = new Map<AbstractExecutable, TestsToRun>();
managers.set(manager, executables);
}
let tests = executables.get(executable);
if (!tests) {
tests = new TestsToRun();
executables.set(executable, tests);
}
tests.implicitAll = true;
} else if (item.children.size) {
item.children.forEach(enumerator('parent'));
}
Expand Down
Loading