Skip to content

Commit f125a07

Browse files
Merge pull request #51 from gjsjohnmurray:sapphire-baboon
Fix running of a single testmethod
2 parents c493171 + 4ece593 commit f125a07

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/commonRunTestsHandler.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,18 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
114114

115115
// enqueue everything up front so user sees immediately which tests will run
116116
mapTestClasses.forEach((test) => {
117+
let methodTarget = "";
118+
if (request.include?.length === 1) {
119+
const idParts = request.include[0].id.split(":");
120+
if (idParts.length === 5) {
121+
methodTarget = request.include[0].id;
122+
}
123+
}
117124
test.children.forEach((methodTest) => {
125+
if (methodTarget && methodTarget !== methodTest.id) {
126+
// User specified a single test method to run, so skip all others
127+
return;
128+
}
118129
run.enqueued(methodTest);
119130
});
120131
});
@@ -253,7 +264,7 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
253264
if (request.include?.length === 1) {
254265
const idParts = request.include[0].id.split(":");
255266
if (idParts.length === 5) {
256-
testSpec = `${username}:${idParts[3]}:${idParts[4]}`;
267+
testSpec = `${username}\\${idParts[3].split(".").slice(0, -1).join("\\")}:${idParts[3]}:${idParts[4]}`;
257268
}
258269
}
259270

src/debugTracker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ export class DebugTracker implements vscode.DebugAdapterTracker {
132132
const assertFailedMatch = line.match(/^(Assert\w+):(.*) \(failed\) <<====/);
133133
if (assertFailedMatch) {
134134
//const macroName = assertFailedMatch[1];
135-
const message = assertFailedMatch[2];
135+
const failedMessage = assertFailedMatch[2];
136136
//console.log(`Class ${this.className}, Test-method ${this.testMethodName}, macroName ${macroName}, outcome 'failed', message=${message}`);
137-
this.failureMessages.push({ message: message });
137+
this.failureMessages.push({ message: failedMessage });
138138
} else {
139139
const assertSkippedMatch = line.match(/^ (Test\w+):(.*) \(skipped\)$/);
140140
if (assertSkippedMatch) {

0 commit comments

Comments
 (0)