more verbose integration test failures

This commit is contained in:
Johannes Rieken 2020-02-14 12:05:01 +01:00
parent c379e3226e
commit 6158372c89

View file

@ -245,6 +245,10 @@ suite('workspace-namespace', () => {
sub.dispose();
});
function assertEqualPath(a: string, b: string): void {
assert.ok(pathEquals(a, b), `${a} <-> ${b}`);
}
test('events: onDidOpenTextDocument, onDidChangeTextDocument, onDidSaveTextDocument', async () => {
const file = await createRandomFile();
let disposables: vscode.Disposable[] = [];
@ -252,19 +256,19 @@ suite('workspace-namespace', () => {
let pendingAsserts: Function[] = [];
let onDidOpenTextDocument = false;
disposables.push(vscode.workspace.onDidOpenTextDocument(e => {
pendingAsserts.push(() => assert.ok(pathEquals(e.uri.fsPath, file.fsPath)));
pendingAsserts.push(() => assertEqualPath(e.uri.fsPath, file.fsPath));
onDidOpenTextDocument = true;
}));
let onDidChangeTextDocument = false;
disposables.push(vscode.workspace.onDidChangeTextDocument(e => {
pendingAsserts.push(() => assert.ok(pathEquals(e.document.uri.fsPath, file.fsPath)));
pendingAsserts.push(() => assertEqualPath(e.document.uri.fsPath, file.fsPath));
onDidChangeTextDocument = true;
}));
let onDidSaveTextDocument = false;
disposables.push(vscode.workspace.onDidSaveTextDocument(e => {
pendingAsserts.push(() => assert.ok(pathEquals(e.uri.fsPath, file.fsPath)));
pendingAsserts.push(() => assertEqualPath(e.uri.fsPath, file.fsPath));
onDidSaveTextDocument = true;
}));
@ -291,7 +295,7 @@ suite('workspace-namespace', () => {
let onDidSaveTextDocument = false;
disposables.push(vscode.workspace.onDidSaveTextDocument(e => {
pendingAsserts.push(() => assert.ok(pathEquals(e.uri.fsPath, file.fsPath)));
pendingAsserts.push(() => assertEqualPath(e.uri.fsPath, file.fsPath));
onDidSaveTextDocument = true;
}));