Skip to content

Commit

Permalink
src/goTest/resolve: fix nested packageDisplayMode handling on win32
Browse files Browse the repository at this point in the history
To use path module, use Uri.fsPath, not Uri.path.

For golang#832
For golang#1788

Change-Id: Ic07e19f2f83cc4b05b3be750de4be7bcdb6e6656
  • Loading branch information
hyangah committed Jul 21, 2022
1 parent f1d5915 commit d247c4b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/goTest/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,12 +328,16 @@ export class GoTestResolver {
}

if (nested) {
const bits = parent.uri ? path.relative(parent.uri.path, uri.path).split(path.sep) : [];
const bits = parent.uri ? path.relative(parent.uri.fsPath, uri.fsPath).split(path.sep) : [];
while (bits.length > 1) {
if (!parent.uri?.path) continue;
const dir = bits.shift();
if (!dir) continue;
const dirUri = uri.with({ path: path.join(parent.uri.path, dir), query: '', fragment: '' });
const dirUri = uri.with({
path: Uri.file(path.join(parent.uri.fsPath, dir)).path,
query: '',
fragment: ''
});
parent = this.getOrCreateItem(parent, dir, dirUri, 'package');
}
}
Expand Down
4 changes: 0 additions & 4 deletions test/integration/goTest.explore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import * as config from '../../src/config';
import { GoTestResolver } from '../../src/goTest/resolve';
import * as testUtils from '../../src/testUtils';
import { GoTest } from '../../src/goTest/utils';
import { affectedByIssue832 } from './testutils';

type Files = Record<string, string | { contents: string; language: string }>;

Expand Down Expand Up @@ -225,9 +224,6 @@ suite('Go Test Explorer', () => {
});

suite('settings', () => {
if (affectedByIssue832()) {
return;
}
const sandbox = sinon.createSandbox();

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down

0 comments on commit d247c4b

Please sign in to comment.