Skip to content

Commit

Permalink
revert some changes due to regression bug
Browse files Browse the repository at this point in the history
  • Loading branch information
matepek committed Jul 26, 2023
1 parent 9c6da28 commit 9f2f710
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 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.5.1]

### Fixed

- regression issue related to [doctest](https://github.com/matepek/vscode-catch2-test-adapter/issues/392)

## [4.5.0] - 2023-07-23

### Changed
Expand Down
3 changes: 2 additions & 1 deletion src/TestItemManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ export class TestItemManager {

createOrReplace(
parent: vscode.TestItem | undefined,
id: string,
testId: string,
label: string,
file: string | undefined,
line: string | number | undefined,
testData: AbstractTest | undefined,
): vscode.TestItem {
const id = testId;
const uri: vscode.Uri | undefined = file ? vscode.Uri.file(file) : undefined;
const item = this.controller.createTestItem(id, label, uri);
if (uri) {
Expand Down
11 changes: 5 additions & 6 deletions src/framework/doctest/DOCExecutable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,18 @@ export class DOCExecutable extends AbstractExecutable<DOCTest> {
description: string | undefined,
skipped: string | undefined,
): Promise<DOCTest> => {
const resolvedFile = this.findSourceFilePath(file);
const id = `${resolvedFile}:${line}:${testName}`;
const tags: string[] = suiteName ? [suiteName] : [];
const skippedB = skipped === 'true';
const resolvedFile = this.findSourceFilePath(file);
return this._createTreeAndAddTest(
this.getTestGrouping(),
id,
testName,
resolvedFile,
line,
tags,
description,
(parent: TestItemParent) =>
new DOCTest(this, parent, id, testName, tags, resolvedFile, line, description, skippedB),
new DOCTest(this, parent, testName, suiteName, tags, resolvedFile, line, description, skippedB),
(test: DOCTest) => test.update2(resolvedFile, line, tags, skippedB, description),
);
};
Expand Down Expand Up @@ -156,8 +155,8 @@ export class DOCExecutable extends AbstractExecutable<DOCTest> {
subTests.unshift(p);
p = p.parentTest;
}
assert(p instanceof DOCTest);
params.push('--test-case=' + (p as DOCTest).getEscapedTestName());
if (!(p instanceof DOCTest)) throw Error('unexpected doctest issue');
params.push('--test-case=' + p.getEscapedTestName());
params.push('--subcase=' + subTests.map(s => s.id.replaceAll(',', '?')).join(','));
params.push('--subcase-filter-levels=' + subTests.length);
} else if (childrenToRun.every(v => v instanceof DOCTest)) {
Expand Down
8 changes: 4 additions & 4 deletions src/framework/doctest/DOCTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export class DOCTest extends AbstractTest {
constructor(
executable: AbstractExecutable,
parent: TestItemParent,
id: string,
testName: string,
testNameAsId: string,
public readonly suiteName: string | undefined,
tags: string[],
file: string | undefined,
line: string | undefined,
Expand All @@ -18,8 +18,8 @@ export class DOCTest extends AbstractTest {
super(
executable,
parent,
id,
testName.startsWith(' Scenario:') ? testName.trimStart() : testName,
testNameAsId,
testNameAsId.startsWith(' Scenario:') ? testNameAsId.trimStart() : testNameAsId,
file,
line,
skipped,
Expand Down

0 comments on commit 9f2f710

Please sign in to comment.