mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-03 15:01:57 +01:00
tsfmt - extensions/vscode-api-tests
This commit is contained in:
@@ -6,12 +6,12 @@
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import {join} from 'path';
|
||||
import {commands, workspace, window, Uri, ViewColumn} from 'vscode';
|
||||
import { join } from 'path';
|
||||
import { commands, workspace, window, Uri, ViewColumn } from 'vscode';
|
||||
|
||||
suite('commands namespace tests', () => {
|
||||
|
||||
test('getCommands', function(done) {
|
||||
test('getCommands', function (done) {
|
||||
|
||||
let p1 = commands.getCommands().then(commands => {
|
||||
let hasOneWithUnderscore = false;
|
||||
@@ -43,7 +43,7 @@ suite('commands namespace tests', () => {
|
||||
test('command with args', function () {
|
||||
|
||||
let args: IArguments;
|
||||
let registration = commands.registerCommand('t1', function() {
|
||||
let registration = commands.registerCommand('t1', function () {
|
||||
args = arguments;
|
||||
});
|
||||
|
||||
@@ -59,7 +59,7 @@ suite('commands namespace tests', () => {
|
||||
test('editorCommand with extra args', function () {
|
||||
|
||||
let args: IArguments;
|
||||
let registration = commands.registerTextEditorCommand('t1', function() {
|
||||
let registration = commands.registerTextEditorCommand('t1', function () {
|
||||
args = arguments;
|
||||
});
|
||||
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import {workspace, window, Position, Range, commands} from 'vscode';
|
||||
import {createRandomFile, deleteFile, cleanUp} from './utils';
|
||||
import { workspace, window, Position, Range, commands } from 'vscode';
|
||||
import { createRandomFile, deleteFile, cleanUp } from './utils';
|
||||
|
||||
suite('editor tests', () => {
|
||||
|
||||
teardown(cleanUp);
|
||||
|
||||
function withRandomFileEditor(initialContents:string, run:(editor:vscode.TextEditor, doc:vscode.TextDocument)=>Thenable<void>): Thenable<boolean> {
|
||||
function withRandomFileEditor(initialContents: string, run: (editor: vscode.TextEditor, doc: vscode.TextDocument) => Thenable<void>): Thenable<boolean> {
|
||||
return createRandomFile(initialContents).then(file => {
|
||||
return workspace.openTextDocument(file).then(doc => {
|
||||
return window.showTextDocument(doc).then((editor) => {
|
||||
@@ -57,7 +57,7 @@ suite('editor tests', () => {
|
||||
});
|
||||
});
|
||||
|
||||
function executeReplace(editor:vscode.TextEditor, range:Range, text:string, undoStopBefore:boolean, undoStopAfter: boolean): Thenable<boolean> {
|
||||
function executeReplace(editor: vscode.TextEditor, range: Range, text: string, undoStopBefore: boolean, undoStopAfter: boolean): Thenable<boolean> {
|
||||
return editor.edit((builder) => {
|
||||
builder.replace(range, text);
|
||||
}, { undoStopBefore: undoStopBefore, undoStopAfter: undoStopAfter });
|
||||
|
||||
@@ -6,18 +6,18 @@
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import {env} from 'vscode';
|
||||
import { env } from 'vscode';
|
||||
|
||||
suite('env-namespace', () => {
|
||||
|
||||
test('env is set', function() {
|
||||
test('env is set', function () {
|
||||
assert.equal(typeof env.language, 'string');
|
||||
assert.equal(typeof env.appName, 'string');
|
||||
assert.equal(typeof env.machineId, 'string');
|
||||
assert.equal(typeof env.sessionId, 'string');
|
||||
});
|
||||
|
||||
test('env is readonly', function() {
|
||||
test('env is readonly', function () {
|
||||
assert.throws(() => env.language = '234');
|
||||
assert.throws(() => env.appName = '234');
|
||||
assert.throws(() => env.machineId = '234');
|
||||
|
||||
@@ -25,4 +25,4 @@ testRunner.configure({
|
||||
timeout: 10000
|
||||
});
|
||||
|
||||
export= testRunner;
|
||||
export = testRunner;
|
||||
@@ -6,9 +6,11 @@
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import {join} from 'path';
|
||||
import {languages, workspace, commands, Uri, Diagnostic, Range, Command, Disposable, CancellationToken,
|
||||
CompletionList, CompletionItem, CompletionItemKind, TextDocument, Position} from 'vscode';
|
||||
import { join } from 'path';
|
||||
import {
|
||||
languages, workspace, commands, Uri, Diagnostic, Range, Command, Disposable, CancellationToken,
|
||||
CompletionList, CompletionItem, CompletionItemKind, TextDocument, Position
|
||||
} from 'vscode';
|
||||
|
||||
suite('languages namespace tests', () => {
|
||||
|
||||
@@ -76,7 +78,7 @@ suite('languages namespace tests', () => {
|
||||
let proposal = new CompletionItem('foo');
|
||||
proposal.kind = CompletionItemKind.Property;
|
||||
ran = true;
|
||||
return [ proposal ];
|
||||
return [proposal];
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import * as assert from 'assert';
|
||||
import * as vscode from 'vscode';
|
||||
import * as fs from 'fs';
|
||||
import * as os from 'os';
|
||||
import {join} from 'path';
|
||||
import { join } from 'path';
|
||||
|
||||
function rndName() {
|
||||
return Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10);
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import {workspace, window, commands, ViewColumn, TextEditorViewColumnChangeEvent, Uri, Selection, Position, CancellationTokenSource, TextEditorSelectionChangeKind} from 'vscode';
|
||||
import {join} from 'path';
|
||||
import {cleanUp, pathEquals} from './utils';
|
||||
import { workspace, window, commands, ViewColumn, TextEditorViewColumnChangeEvent, Uri, Selection, Position, CancellationTokenSource, TextEditorSelectionChangeKind } from 'vscode';
|
||||
import { join } from 'path';
|
||||
import { cleanUp, pathEquals } from './utils';
|
||||
|
||||
suite('window namespace tests', () => {
|
||||
|
||||
@@ -88,7 +88,7 @@ suite('window namespace tests', () => {
|
||||
const file30Path = join(workspace.rootPath, './30linefile.ts');
|
||||
|
||||
let finished = false;
|
||||
let failOncePlease = (err:Error) => {
|
||||
let failOncePlease = (err: Error) => {
|
||||
if (finished) {
|
||||
return;
|
||||
}
|
||||
@@ -127,13 +127,13 @@ suite('window namespace tests', () => {
|
||||
workspace.openTextDocument(file10Path).then((doc) => {
|
||||
return window.showTextDocument(doc, ViewColumn.One);
|
||||
}).then((editor10line) => {
|
||||
editor10line.selection = new Selection(new Position(9,0), new Position(9, 0));
|
||||
editor10line.selection = new Selection(new Position(9, 0), new Position(9, 0));
|
||||
}).then(() => {
|
||||
return workspace.openTextDocument(file30Path);
|
||||
}).then((doc) => {
|
||||
return window.showTextDocument(doc, ViewColumn.One);
|
||||
}).then((editor30line) => {
|
||||
editor30line.selection = new Selection(new Position(29,0), new Position(29, 0));
|
||||
editor30line.selection = new Selection(new Position(29, 0), new Position(29, 0));
|
||||
}).then(() => {
|
||||
return workspace.openTextDocument(file10Path);
|
||||
}).then((doc) => {
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import {workspace, TextDocument, window, Position, Uri, EventEmitter, WorkspaceEdit} from 'vscode';
|
||||
import {createRandomFile, deleteFile, cleanUp, pathEquals} from './utils';
|
||||
import {join, basename} from 'path';
|
||||
import { workspace, TextDocument, window, Position, Uri, EventEmitter, WorkspaceEdit } from 'vscode';
|
||||
import { createRandomFile, deleteFile, cleanUp, pathEquals } from './utils';
|
||||
import { join, basename } from 'path';
|
||||
import * as fs from 'fs';
|
||||
|
||||
suite('workspace-namespace', () => {
|
||||
@@ -38,7 +38,7 @@ suite('workspace-namespace', () => {
|
||||
assert.ok(config.has('get'));
|
||||
assert.equal(config.get('get'), 'get-prop');
|
||||
assert.deepEqual(config['get'], config.get);
|
||||
assert.throws(() => config['get'] = <any> 'get-prop');
|
||||
assert.throws(() => config['get'] = <any>'get-prop');
|
||||
});
|
||||
|
||||
// test('configuration, getConfig/value', () => {
|
||||
|
||||
Reference in New Issue
Block a user