Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlad Barosan committed Mar 7, 2019
1 parent b2fceb4 commit 823cd2d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/debugAdapter/goDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,10 @@ class Delve {
}

private privateGetLocalDebugeePath(output: string | undefined): string {
const configOutput = output || "debug"
const configOutput = output || 'debug';
return path.isAbsolute(configOutput)
? configOutput
: path.resolve(this.program, configOutput)
: path.resolve(this.program, configOutput);
}

private async ensureDebugeeExecutableIsRemoved(): Promise<void> {
Expand All @@ -552,7 +552,7 @@ class Delve {
await fs.remove(this.localDebugeePath);
}
} catch (e) {
logError(`Failed to potentially remove leftover debug file ${this.localDebugeePath} - ${e.toString() || ""}`)
logError(`Failed to potentially remove leftover debug file ${this.localDebugeePath} - ${e.toString() || ''}`);
}
}

Expand Down
26 changes: 11 additions & 15 deletions test/go.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,22 +544,18 @@ It returns the number of bytes written and any write error encountered.
test('Test Outline document symbols', (done) => {
const uri = vscode.Uri.file(path.join(fixturePath, 'outlineTest', 'test.go'));
vscode.workspace.openTextDocument(uri).then(document => {
new GoDocumentSymbolProvider().provideDocumentSymbols(document, null).then(symbols => {
const groupedSymbolNames = symbols.reduce((map: any, symbol) => {
map[symbol.kind] = (map[symbol.kind] || []).concat([symbol.name]);
return map;
}, {});

const packageNames = groupedSymbolNames[vscode.SymbolKind.Package];
const variableNames = groupedSymbolNames[vscode.SymbolKind.Variable];
const functionNames = groupedSymbolNames[vscode.SymbolKind.Function];
const structs = groupedSymbolNames[vscode.SymbolKind.Struct];
assert.equal(packageNames[0], 'main');
assert.equal(variableNames, undefined);
assert.equal(functionNames[0], 'print');
assert.equal(functionNames[1], 'main');
new GoDocumentSymbolProvider().provideDocumentSymbols(document, null).then(outlines => {
const packages = outlines.filter(x => x.kind === vscode.SymbolKind.Package);
const variables = outlines[0].children.filter((x: any) => x.kind === vscode.SymbolKind.Variable);
const functions = outlines[0].children.filter((x: any) => x.kind === vscode.SymbolKind.Function);
const structs = outlines[0].children.filter((x: any) => x.kind === vscode.SymbolKind.Struct);

assert.equal(packages[0].name, 'main');
assert.equal(variables.length, 0);
assert.equal(functions[0].name, 'print');
assert.equal(functions[1].name, 'main');
assert.equal(structs.length, 1);
assert.equal(structs[0], 'foo');
assert.equal(structs[0].name, 'foo');
});
}).then(() => done(), done);
});
Expand Down

0 comments on commit 823cd2d

Please sign in to comment.