Skip to content

Commit

Permalink
master: fixed source file resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Mate Pek committed Nov 23, 2021
1 parent 7077e82 commit b4dc939
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

- Improved Output formatting and colorization

### Fixed

- navigation to source file related issue

## [4.0.2] - 2021-11-22

### Added
Expand Down
9 changes: 5 additions & 4 deletions src/AbstractExecutable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -782,15 +782,16 @@ export abstract class AbstractExecutable implements Disposable {
}

resolved = await this.resolveText(resolved);
resolved = pathlib.normalize(resolved);
resolved = this._findFilePath(resolved);

this.shared.log.debug('_resolveSourceFilePath:', file, '=>', resolved);

return resolved;
}

protected _findFilePath(matchedPath: string): string {
if (pathlib.isAbsolute(matchedPath)) return matchedPath;
private _findFilePath(path: string): string {
if (pathlib.isAbsolute(path)) return path;

const directoriesToCheck: string[] = [pathlib.dirname(this.properties.path)];

Expand All @@ -804,9 +805,9 @@ export abstract class AbstractExecutable implements Disposable {
)
directoriesToCheck.push(this.shared.workspaceFolder.uri.fsPath);

const found = getAbsolutePath(matchedPath, directoriesToCheck);
const found = getAbsolutePath(path, directoriesToCheck);

return found || matchedPath;
return found || path;
}

public sendStaticEvents(
Expand Down
6 changes: 3 additions & 3 deletions src/framework/GoogleTestExecutable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { TestGrouping } from '../TestGroupingInterface';
import { TestResultBuilder } from '../TestResultBuilder';
import { XmlParser, XmlTag, XmlTagProcessor } from '../util/XmlParser';
import { LineProcessor, TextStreamParser } from '../util/TextStreamParser';
import { debugAssert, debugBreak } from '../util/DevelopmentHelper';
import { assert, debugBreak } from '../util/DevelopmentHelper';

export class GoogleTestExecutable extends AbstractExecutable {
public constructor(shared: WorkspaceShared, execInfo: RunnableProperties, private readonly _argumentPrefix: string) {
Expand Down Expand Up @@ -318,8 +318,8 @@ class TestSuiteListingProcessor implements XmlTagProcessor {
onopentag(tag: XmlTag): void {
switch (tag.name) {
case 'testcase': {
debugAssert(this.suiteName);
debugAssert(tag.attribs.name);
assert(this.suiteName);
assert(tag.attribs.name);
this.create(
tag.attribs.name,
this.suiteName!,
Expand Down

0 comments on commit b4dc939

Please sign in to comment.