This commit is contained in:
Johannes Rieken 2020-06-25 10:20:34 +02:00
parent e5d08ae4bc
commit ef9a24f021

View file

@ -61,11 +61,18 @@ suite('vscode API - workspace', () => {
});
test('openTextDocument', async () => {
const len = vscode.workspace.textDocuments.length;
const uri = await createRandomFile();
// not yet there
const existing1 = vscode.workspace.textDocuments.find(doc => doc.uri.toString() === uri.toString());
assert.equal(existing1, undefined);
// open and assert its there
const doc = await vscode.workspace.openTextDocument(uri);
assert.ok(doc);
assert.equal(vscode.workspace.textDocuments.length, len + 1);
assert.equal(doc.uri.toString(), uri.toString());
const existing2 = vscode.workspace.textDocuments.find(doc => doc.uri.toString() === uri.toString());
assert.equal(existing2 === doc, true);
});
test('openTextDocument, illegal path', () => {