|
| 1 | +import * as vscode from 'vscode'; |
| 2 | +import * as path from 'path'; |
| 3 | +import { strictEqual } from 'assert'; |
| 4 | +import { FortranLintingProvider } from '../../src/features/linter-provider'; |
| 5 | +import { |
| 6 | + CleanLintDiagnostics, |
| 7 | + CleanLintFiles, |
| 8 | + InitLint, |
| 9 | + RescanLint, |
| 10 | +} from '../../src/features/commands'; |
| 11 | + |
| 12 | +suite('Linter', async () => { |
| 13 | + let doc: vscode.TextDocument; |
| 14 | + const fileUri = vscode.Uri.file(path.resolve(__dirname, '../../../test/fortran/sample.f90')); |
| 15 | + const linter = new FortranLintingProvider(); |
| 16 | + |
| 17 | + suiteSetup(async () => { |
| 18 | + doc = await vscode.workspace.openTextDocument(fileUri); |
| 19 | + await vscode.window.showTextDocument(doc); |
| 20 | + }); |
| 21 | + |
| 22 | + test('Check disposables array has been populated', async () => { |
| 23 | + await linter.activate(); |
| 24 | + strictEqual(linter['subscriptions'].length > 1, true); |
| 25 | + }); |
| 26 | + |
| 27 | + // test(`Run command ${InitLint}`, async () => { |
| 28 | + // await vscode.commands.executeCommand(InitLint); |
| 29 | + // }); |
| 30 | + |
| 31 | + test(`Run command is ${RescanLint}`, async () => { |
| 32 | + await vscode.commands.executeCommand(RescanLint); |
| 33 | + }); |
| 34 | + |
| 35 | + test(`Run command ${CleanLintDiagnostics}`, async () => { |
| 36 | + await vscode.commands.executeCommand(CleanLintDiagnostics); |
| 37 | + }); |
| 38 | + |
| 39 | + test(`Run command ${CleanLintFiles}`, async () => { |
| 40 | + await vscode.commands.executeCommand(CleanLintFiles); |
| 41 | + }); |
| 42 | + |
| 43 | + test('Check disposables have been cleared', () => { |
| 44 | + linter.dispose(); |
| 45 | + strictEqual(linter['subscriptions'].length, 0); |
| 46 | + }); |
| 47 | +}); |
0 commit comments