From e6ccec6447becf6e8efe1430ca71139cdd010cf0 Mon Sep 17 00:00:00 2001 From: Elie Richa Date: Fri, 12 Apr 2024 15:06:38 +0000 Subject: [PATCH 1/7] Make vscode tests report activation failures better --- integration/vscode/ada/test/suite/utils.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/integration/vscode/ada/test/suite/utils.ts b/integration/vscode/ada/test/suite/utils.ts index f1938daa0..da56ae164 100644 --- a/integration/vscode/ada/test/suite/utils.ts +++ b/integration/vscode/ada/test/suite/utils.ts @@ -1,9 +1,5 @@ import assert from 'assert'; import { existsSync, readFileSync, writeFileSync } from 'fs'; -import { Glob, GlobOptionsWithFileTypesUnset } from 'glob'; -import Mocha, { MochaOptions } from 'mocha'; -import path from 'path'; -import { env } from 'process'; import * as vscode from 'vscode'; /** @@ -54,9 +50,12 @@ export function update(): boolean { */ export async function activate(): Promise { const ext = vscode.extensions.getExtension('AdaCore.ada'); - if (ext !== undefined) { - if (!ext.isActive) { - await ext.activate(); - } - } + assert(ext); + /** + * Previously this code returned when ext.isActive was true. This is not + * enough because it doesn't indicate if any errors occured during + * activation. Instead, always awaiting the result of the activate() method + * does report activation errors as a promise rejection. + */ + await ext.activate(); } From 27289e02047eb4f4286a5c5cb55111438f92a967 Mon Sep 17 00:00:00 2001 From: Elie Richa Date: Fri, 12 Apr 2024 15:05:16 +0000 Subject: [PATCH 2/7] Work around the vscode-test drive letter bug --- Makefile | 2 +- integration/vscode/ada/.vscodeignore | 1 + .../vscode/ada/vscode-test-win-workaround.py | 23 +++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 integration/vscode/ada/vscode-test-win-workaround.py diff --git a/Makefile b/Makefile index 638ef3b25..dc1933247 100644 --- a/Makefile +++ b/Makefile @@ -152,7 +152,7 @@ endif vscode-test: # Run the VS Code integration testsuite. - MOCHA_ALS_UPDATE=$(MOCHA_ALS_UPDATE) cd integration/vscode/ada; LD_LIBRARY_PATH= npm run test + cd integration/vscode/ada; MOCHA_ALS_UPDATE=$(MOCHA_ALS_UPDATE) LD_LIBRARY_PATH= python vscode-test-win-workaround.py npm run test vscode-package: cd integration/vscode/ada; LD_LIBRARY_PATH= $(VSCE) package diff --git a/integration/vscode/ada/.vscodeignore b/integration/vscode/ada/.vscodeignore index 9c0e0a8e4..025b767a5 100644 --- a/integration/vscode/ada/.vscodeignore +++ b/integration/vscode/ada/.vscodeignore @@ -15,3 +15,4 @@ tsconfig.json **/*.ts **/*.ts.map xfail.yaml +vscode-test-win-workaround.py diff --git a/integration/vscode/ada/vscode-test-win-workaround.py b/integration/vscode/ada/vscode-test-win-workaround.py new file mode 100755 index 000000000..16fa5e6c5 --- /dev/null +++ b/integration/vscode/ada/vscode-test-win-workaround.py @@ -0,0 +1,23 @@ +""" +The vscode-test tool has a bug on Windows. There is a workaround of spawning the node +process with a CWD that has a lowercase drive letter. This script implements that +workaround. + +See https://github.com/microsoft/vscode-test/issues/136#issuecomment-2049714028 +""" + +import os +from pathlib import Path +import subprocess +import sys + + +cwd = Path().absolute() + +windows = os.environ.get("OS") == "Windows_NT" +if windows: + # Convert the path to a lowercase drive letter + cwd = Path(f"{cwd.drive.lower()}\\", *cwd.parts[1:]) + +# Use shell=True on Windows to resolve the first argument based on PATH +exit(subprocess.call(sys.argv[1:], cwd=cwd, shell=windows)) From f69220bd93d882ff233f041e473cd2f8f4e9bdc9 Mon Sep 17 00:00:00 2001 From: Elie Richa Date: Thu, 28 Mar 2024 16:48:56 +0000 Subject: [PATCH 3/7] Improve reporting of test harness build failure --- integration/vscode/ada/src/gnattest.ts | 97 ++++++++++++------- integration/vscode/ada/src/helpers.ts | 11 +++ .../ada/test/suite/gnattest/gnattest.test.ts | 15 ++- 3 files changed, 80 insertions(+), 43 deletions(-) diff --git a/integration/vscode/ada/src/gnattest.ts b/integration/vscode/ada/src/gnattest.ts index 14499e33c..692d07322 100644 --- a/integration/vscode/ada/src/gnattest.ts +++ b/integration/vscode/ada/src/gnattest.ts @@ -7,7 +7,7 @@ import * as vscode from 'vscode'; import { TestItem } from 'vscode'; import { CancellationToken } from 'vscode-languageclient'; import { adaExtState } from './extension'; -import { exe, getObjectDir } from './helpers'; +import { escapeRegExp, exe, getObjectDir } from './helpers'; export let controller: vscode.TestController; export let testRunProfile: vscode.TestRunProfile; @@ -524,17 +524,20 @@ async function handleRunRequestedTests(request: vscode.TestRunRequest, token?: C return !excludedLeafTests?.includes(t); }); - await buildTestDriver(run); + /** + * Mark tests as queued + */ + testsToRun.forEach((t) => run.enqueued(t)); + + /** + * Build the test driver + */ + await buildTestDriverAndReportErrors(run, testsToRun); if (token?.isCancellationRequested) { throw new vscode.CancellationError(); } - /** - * Mark tests as queued for execution - */ - testsToRun.forEach((t) => run.enqueued(t)); - /** * Invoke the test driver for each test */ @@ -563,6 +566,30 @@ async function handleRunRequestedTests(request: vscode.TestRunRequest, token?: C } } +/** + * Build the test driver and report build failure as errors on the tests + * requested for execution. + * + * @param run - the TestRun hosting the execution + * @param testsToRun - the tests requested for execution - build failure will be + * reported on those tests. + */ +async function buildTestDriverAndReportErrors(run: vscode.TestRun, testsToRun: vscode.TestItem[]) { + try { + await buildTestDriver(run); + } catch (error) { + /** + * In case of failure, report all tests as errored. + */ + const md = getBuildErrorMessage(); + for (const test of testsToRun) { + run.errored(test, new vscode.TestMessage(md)); + } + run.end(); + throw error; + } +} + /** * VS Code terminals expect `\r\n` as a line separator, so this function is * a wrapper to prepare the given output to use that line separator and @@ -584,9 +611,19 @@ async function handleRunAll(request: vscode.TestRunRequest, token?: Cancellation const run = controller.createTestRun(request, undefined, false); try { /** - * First we need to build the test driver project. + * Collect all tests, i.e. all leafs of the TestItem tree. */ - await buildTestDriver(run); + const allTests: TestItem[] = collectLeafsFromCollection(controller.items, token); + + /** + * Mark tests as queued + */ + allTests.forEach((t) => run.enqueued(t)); + + /** + * Build the test driver + */ + await buildTestDriverAndReportErrors(run, allTests); if (token?.isCancellationRequested) { throw new vscode.CancellationError(); @@ -603,11 +640,6 @@ async function handleRunAll(request: vscode.TestRunRequest, token?: Cancellation throw new vscode.CancellationError(); } - /** - * Now let's collect all tests, i.e. all leafs of the TestItem tree. - */ - const allTests: TestItem[] = collectLeafsFromCollection(controller.items, token); - /** * Mark all tests as started. */ @@ -645,6 +677,21 @@ async function handleRunAll(request: vscode.TestRunRequest, token?: Cancellation } } +/** + * Failures to build the test driver are reported as test errors to make them + * clearly visible. + * + * @returns the message to be used as a test failure when the test driver fails + * to build. + */ +function getBuildErrorMessage() { + const md = new vscode.MarkdownString( + 'Failed to build the test driver, [view output](command:testing.showMostRecentOutput)' + ); + md.isTrusted = true; + return md; +} + /** * Invoke gprbuild on the test driver project and pipe the output into the given * TestRun object. @@ -658,21 +705,12 @@ async function buildTestDriver(run: vscode.TestRun) { */ const driverPrjPath = await getGnatTestDriverProjectPath(); run.appendOutput(`Building the test harness project\r\n`); - const gprbuild = logAndRun(run, ['gprbuild', '-P', driverPrjPath]); + const gprbuild = logAndRun(run, ['gprbuild', '-P', driverPrjPath, '-cargs:ada', '-gnatef']); prepareAndAppendOutput(run, gprbuild.stdout.toLocaleString()); prepareAndAppendOutput(run, gprbuild.stderr.toLocaleString()); if (gprbuild.status !== 0) { - /** - * Failed to build the test driver. The output of gprbuild is - * usually pretty explicit so no need to add an error message. - * - * No need to show an error tooltip because the exception raised below - * already causes that. - */ - run.end(); - throw Error('Error while building the test driver'); } } @@ -798,17 +836,6 @@ export function collectLeafItems(item: TestItem, token?: CancellationToken): vsc } } -/** - * - * @param text - a string possibly containing special RegExp characters. - * @returns a string where all RegExp special characters have been escaped. This - * can be useful when searching for an exact string which may contain special - * characters. - */ -function escapeRegExp(text: string) { - return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); -} - /** * * Run a command line as a child process and pipe the output into the TestRun diff --git a/integration/vscode/ada/src/helpers.ts b/integration/vscode/ada/src/helpers.ts index 0c8865151..f13355135 100644 --- a/integration/vscode/ada/src/helpers.ts +++ b/integration/vscode/ada/src/helpers.ts @@ -425,3 +425,14 @@ export function getSymbols( return allSymbols; } + +/** + * + * @param text - a string possibly containing special RegExp characters. + * @returns a string where all RegExp special characters have been escaped. This + * can be useful when searching for an exact string which may contain special + * characters. + */ +export function escapeRegExp(text: string) { + return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); +} diff --git a/integration/vscode/ada/test/suite/gnattest/gnattest.test.ts b/integration/vscode/ada/test/suite/gnattest/gnattest.test.ts index a984f7269..8ab10b063 100644 --- a/integration/vscode/ada/test/suite/gnattest/gnattest.test.ts +++ b/integration/vscode/ada/test/suite/gnattest/gnattest.test.ts @@ -28,6 +28,7 @@ import { runHandler, } from '../../../src/gnattest'; import { activate } from '../utils'; +import { escapeRegExp } from '../../../src/helpers'; suite('GNATtest Integration Tests', function () { this.beforeAll(async () => { @@ -329,8 +330,7 @@ bar */ const buildOutput = ` Building the test harness project -$ "gprbuild" "-P" "${await getGnatTestDriverProjectPath()}" -`.trimStart(); +$ "gprbuild" "-P" "${await getGnatTestDriverProjectPath()}"`.trimStart(); const runOutput = ` Running the test driver $ "${await getGnatTestDriverExecPath()}" "--passed-tests=show" @@ -340,10 +340,9 @@ speed2.ads:12:4: info: corresponding test PASSED speed2.ads:16:4: info: corresponding test PASSED speed1.ads:12:4: inherited at speed2.ads:20:4: info: corresponding test PASSED speed2.ads:10:4: error: corresponding test FAILED: Test not implemented. (speed2-auto_controller_test_data-auto_controller_tests.adb:46) -6 tests run: 5 passed; 1 failed; 0 crashed. -`.trimStart(); - assert.ok(outputs.includes(buildOutput)); - assert.ok(outputs.includes(runOutput)); +6 tests run: 5 passed; 1 failed; 0 crashed.`.trimStart(); + assert.match(outputs, RegExp(escapeRegExp(buildOutput))); + assert.match(outputs, RegExp(escapeRegExp(runOutput))); /** * Check that calling the run handler with an empty include array @@ -351,8 +350,8 @@ speed2.ads:10:4: error: corresponding test FAILED: Test not implemented. (speed2 */ outputs = ''; await runHandler({ include: [], exclude: undefined, profile: undefined }, undefined); - assert.ok(outputs.includes(buildOutput)); - assert.ok(outputs.includes(runOutput)); + assert.match(outputs, RegExp(escapeRegExp(buildOutput))); + assert.match(outputs, RegExp(escapeRegExp(runOutput))); } finally { /** * Reset the controller object on which we set a spy From cc106272e2e4b3d6550265daf965312dbadda090 Mon Sep 17 00:00:00 2001 From: Elie Richa Date: Thu, 11 Apr 2024 10:00:05 +0000 Subject: [PATCH 4/7] Rearrange .gitignore files for vscode test workspaces --- integration/vscode/ada/.gitignore | 1 - .../vscode/ada/test/workspaces/general/.gitignore | 5 +++++ .../general/default_without_obj_dir/.gitignore | 9 +++++++++ .../vscode/ada/test/workspaces/gnattest/.gitignore | 2 ++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 integration/vscode/ada/test/workspaces/general/.gitignore create mode 100644 integration/vscode/ada/test/workspaces/general/default_without_obj_dir/.gitignore create mode 100644 integration/vscode/ada/test/workspaces/gnattest/.gitignore diff --git a/integration/vscode/ada/.gitignore b/integration/vscode/ada/.gitignore index 1797b363d..1c23f4708 100644 --- a/integration/vscode/ada/.gitignore +++ b/integration/vscode/ada/.gitignore @@ -2,7 +2,6 @@ /*.vsix /out/ /.vscode-test/ -**/obj/ # Locations of ALS executable in VS Code extension. VS Code is supported on arm, # arm64 and x64 so we only consider those architectures. diff --git a/integration/vscode/ada/test/workspaces/general/.gitignore b/integration/vscode/ada/test/workspaces/general/.gitignore new file mode 100644 index 000000000..f20ef5bc4 --- /dev/null +++ b/integration/vscode/ada/test/workspaces/general/.gitignore @@ -0,0 +1,5 @@ +# Object dir of the project +/obj/ + +# Generated when testing gnatsas tasks +/report.sarif diff --git a/integration/vscode/ada/test/workspaces/general/default_without_obj_dir/.gitignore b/integration/vscode/ada/test/workspaces/general/default_without_obj_dir/.gitignore new file mode 100644 index 000000000..f4415524f --- /dev/null +++ b/integration/vscode/ada/test/workspaces/general/default_without_obj_dir/.gitignore @@ -0,0 +1,9 @@ +# This project has no Object_Dir defined, so we have to git-ignore specific +# extensions and files +/*.o +/*.ali +/*.stdout +/*.stderr +/b__*.ad? +/*.bexch +/main1exec diff --git a/integration/vscode/ada/test/workspaces/gnattest/.gitignore b/integration/vscode/ada/test/workspaces/gnattest/.gitignore new file mode 100644 index 000000000..a8ef5e6ee --- /dev/null +++ b/integration/vscode/ada/test/workspaces/gnattest/.gitignore @@ -0,0 +1,2 @@ +# Object dir of the project +/obj/ From 83174455b32e84e1516959286e0503c8cb3eb03f Mon Sep 17 00:00:00 2001 From: Elie Richa Date: Thu, 11 Apr 2024 10:06:31 +0000 Subject: [PATCH 5/7] Change vscode task test to restore the workspace settings --- .../vscode/ada/test/suite/general/tasks.test.ts | 12 ++++++++++-- .../test/workspaces/general/.vscode/settings.json | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 integration/vscode/ada/test/workspaces/general/.vscode/settings.json diff --git a/integration/vscode/ada/test/suite/general/tasks.test.ts b/integration/vscode/ada/test/suite/general/tasks.test.ts index 8206f608a..30397a713 100644 --- a/integration/vscode/ada/test/suite/general/tasks.test.ts +++ b/integration/vscode/ada/test/suite/general/tasks.test.ts @@ -268,8 +268,16 @@ ada: Build and run main - src/test.adb - kind: buildAndRunMain`.trim(); const execStatus: number | undefined = await runTaskAndGetResult(task); assert.equal(execStatus, 0); } finally { - // Reset the 'ada.projectFile' setting. - await vscode.workspace.getConfiguration().update('ada.projectFile', initialProjectFile); + // Reset the 'ada.projectFile' setting. If the previous value was + // empty, update to 'undefined' so that the setting gets removed. + // That's because the default value of that setting is the empty + // string. + await vscode.workspace + .getConfiguration() + .update( + 'ada.projectFile', + initialProjectFile === '' ? undefined : initialProjectFile + ); } }); diff --git a/integration/vscode/ada/test/workspaces/general/.vscode/settings.json b/integration/vscode/ada/test/workspaces/general/.vscode/settings.json new file mode 100644 index 000000000..2c63c0851 --- /dev/null +++ b/integration/vscode/ada/test/workspaces/general/.vscode/settings.json @@ -0,0 +1,2 @@ +{ +} From 62b8a468183d9f6c910e732231a4b4ff100b0979 Mon Sep 17 00:00:00 2001 From: Maxim Reznik Date: Thu, 18 Apr 2024 16:53:13 +0300 Subject: [PATCH 6/7] Fix precondition/assertion checks on GS and TypeScript tests. Refs #1141 --- source/ada/lsp-ada_document_symbol.adb | 3 +++ source/ada/lsp-ada_highlighters.adb | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/source/ada/lsp-ada_document_symbol.adb b/source/ada/lsp-ada_document_symbol.adb index b9f17569d..77a854df5 100644 --- a/source/ada/lsp-ada_document_symbol.adb +++ b/source/ada/lsp-ada_document_symbol.adb @@ -412,6 +412,9 @@ package body LSP.Ada_Document_Symbol is when Libadalang.Common.Ada_Basic_Decl => for Name of Node.As_Basic_Decl.P_Defining_Names loop + + exit when Name.Is_Null; + Append_Name (Name => Name, Text => VSS.Strings.To_Virtual_String (Name.Text), diff --git a/source/ada/lsp-ada_highlighters.adb b/source/ada/lsp-ada_highlighters.adb index 0888faf86..9c7b2882b 100644 --- a/source/ada/lsp-ada_highlighters.adb +++ b/source/ada/lsp-ada_highlighters.adb @@ -353,6 +353,10 @@ package body LSP.Ada_Highlighters is Token : Libadalang.Common.Token_Reference := From_Token; begin + if Libadalang.Common.Is_Trivia (Token) then + Token := Libadalang.Common.Next (Token, Exclude_Trivia => True); + end if; + -- Scan over all tokens and find a corresponding value in Holder while Token < To_Token loop From f3702d16571a270883a94f7ea18e72e032ef8b95 Mon Sep 17 00:00:00 2001 From: Philippe Gil Date: Thu, 18 Apr 2024 18:16:02 +0200 Subject: [PATCH 7/7] adapt test after GPR2 bump. See eng/shared/anod#300 --- .../others/test.yaml | 3 - .../{others => }/prj.gpr | 0 .../{others => }/test.json | 0 .../import_using_space_string/test.yaml | 1 + .../import_using_space_string/windows/prj.gpr | 3 - .../windows/test.json | 254 ---------- .../windows/test.yaml | 3 - .../others/test.yaml | 3 - .../{others => }/prj.gpr | 0 .../{others => }/test.json | 0 .../invalid_file_name_support/test.yaml | 2 + .../invalid_file_name_support/windows/prj.gpr | 4 - .../windows/test.json | 453 ------------------ .../windows/test.yaml | 3 - 14 files changed, 3 insertions(+), 726 deletions(-) delete mode 100644 testsuite/gpr_lsp/import_using_space_string/others/test.yaml rename testsuite/gpr_lsp/import_using_space_string/{others => }/prj.gpr (100%) rename testsuite/gpr_lsp/import_using_space_string/{others => }/test.json (100%) create mode 100644 testsuite/gpr_lsp/import_using_space_string/test.yaml delete mode 100644 testsuite/gpr_lsp/import_using_space_string/windows/prj.gpr delete mode 100644 testsuite/gpr_lsp/import_using_space_string/windows/test.json delete mode 100644 testsuite/gpr_lsp/import_using_space_string/windows/test.yaml delete mode 100644 testsuite/gpr_lsp/invalid_file_name_support/others/test.yaml rename testsuite/gpr_lsp/invalid_file_name_support/{others => }/prj.gpr (100%) rename testsuite/gpr_lsp/invalid_file_name_support/{others => }/test.json (100%) create mode 100644 testsuite/gpr_lsp/invalid_file_name_support/test.yaml delete mode 100644 testsuite/gpr_lsp/invalid_file_name_support/windows/prj.gpr delete mode 100644 testsuite/gpr_lsp/invalid_file_name_support/windows/test.json delete mode 100644 testsuite/gpr_lsp/invalid_file_name_support/windows/test.yaml diff --git a/testsuite/gpr_lsp/import_using_space_string/others/test.yaml b/testsuite/gpr_lsp/import_using_space_string/others/test.yaml deleted file mode 100644 index 56ea3d85b..000000000 --- a/testsuite/gpr_lsp/import_using_space_string/others/test.yaml +++ /dev/null @@ -1,3 +0,0 @@ -title: 'check with " "; support' -skip: - - ['SKIP', 'env.build.os.name in ("windows")'] \ No newline at end of file diff --git a/testsuite/gpr_lsp/import_using_space_string/others/prj.gpr b/testsuite/gpr_lsp/import_using_space_string/prj.gpr similarity index 100% rename from testsuite/gpr_lsp/import_using_space_string/others/prj.gpr rename to testsuite/gpr_lsp/import_using_space_string/prj.gpr diff --git a/testsuite/gpr_lsp/import_using_space_string/others/test.json b/testsuite/gpr_lsp/import_using_space_string/test.json similarity index 100% rename from testsuite/gpr_lsp/import_using_space_string/others/test.json rename to testsuite/gpr_lsp/import_using_space_string/test.json diff --git a/testsuite/gpr_lsp/import_using_space_string/test.yaml b/testsuite/gpr_lsp/import_using_space_string/test.yaml new file mode 100644 index 000000000..3950b4dd5 --- /dev/null +++ b/testsuite/gpr_lsp/import_using_space_string/test.yaml @@ -0,0 +1 @@ +title: 'check with " "; support' diff --git a/testsuite/gpr_lsp/import_using_space_string/windows/prj.gpr b/testsuite/gpr_lsp/import_using_space_string/windows/prj.gpr deleted file mode 100644 index 4588a6fc0..000000000 --- a/testsuite/gpr_lsp/import_using_space_string/windows/prj.gpr +++ /dev/null @@ -1,3 +0,0 @@ -with " "; -project Prj is -end Prj; \ No newline at end of file diff --git a/testsuite/gpr_lsp/import_using_space_string/windows/test.json b/testsuite/gpr_lsp/import_using_space_string/windows/test.json deleted file mode 100644 index 90cff16e2..000000000 --- a/testsuite/gpr_lsp/import_using_space_string/windows/test.json +++ /dev/null @@ -1,254 +0,0 @@ -[ - { - "comment": [ - "check with \" \"; support" - ] - }, - { - "start": { - "cmd": [ - "${ALS}", - "--language-gpr" - ] - } - }, - { - "send": { - "request": { - "jsonrpc": "2.0", - "id": "init", - "method": "initialize", - "params": { - "processId": 441587, - "rootUri": "$URI{.}", - "capabilities": { - "workspace": { - "applyEdit": true, - "workspaceEdit": {}, - "didChangeConfiguration": {}, - "didChangeWatchedFiles": {}, - "executeCommand": {} - }, - "textDocument": { - "synchronization": {}, - "completion": { - "dynamicRegistration": true, - "completionItem": { - "snippetSupport": true, - "documentationFormat": [ - "plaintext", - "markdown" - ] - } - }, - "hover": {}, - "definition": {}, - "documentSymbol": { - "hierarchicalDocumentSymbolSupport": true - } - } - } - } - }, - "wait": [ - { - "jsonrpc": "2.0", - "id": "init", - "result": { - "capabilities": { - "textDocumentSync": { - "openClose": true, - "change": 1 - }, - "completionProvider": { - "triggerCharacters": [ - " " - ], - "resolveProvider": true - }, - "hoverProvider": true, - "definitionProvider": true, - "documentSymbolProvider": {} - } - } - } - ] - } - }, - { - "send": { - "request": { - "jsonrpc": "2.0", - "method": "initialized" - }, - "wait": [] - } - }, - { - "send": { - "request": { - "jsonrpc": "2.0", - "method": "textDocument/didOpen", - "params": { - "textDocument": { - "uri": "$URI{prj.gpr}", - "languageId": "gpr", - "version": 1, - "text": "with \" \";\nproject Prj is\nend Prj;" - } - } - }, - "wait": [ - { - "jsonrpc": "2.0", - "method": "textDocument/publishDiagnostics", - "params": { - "uri": "$URI{prj.gpr}", - "diagnostics": [ - { - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 0 - } - }, - "severity": 1, - "message": "GPR parser unexpected ADA.IO_EXCEPTIONS.NAME_ERROR invalid path name \" \"" - } - ] - } - } - ] - } - }, - { - "send": { - "request": { - "jsonrpc": "2.0", - "id": "textDocument/documentSymbol_prj_1", - "method": "textDocument/documentSymbol", - "params": { - "textDocument": { - "uri": "$URI{prj.gpr}" - } - } - }, - "wait": [ - { - "jsonrpc": "2.0", - "id": "textDocument/documentSymbol_prj_1", - "result": [ - { - "name": "with clauses", - "kind": 3, - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 0 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 0 - } - }, - "children": [ - { - "name": " ", - "kind": 3, - "range": { - "start": { - "line": 0, - "character": 5 - }, - "end": { - "line": 0, - "character": 8 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 5 - }, - "end": { - "line": 0, - "character": 8 - } - } - } - ] - }, - { - "name": "Prj", - "kind": 2, - "range": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 1, - "character": 7 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 0 - }, - "end": { - "line": 1, - "character": 7 - } - } - } - ] - } - ] - } - }, - { - "send": { - "request": { - "jsonrpc": "2.0", - "id": "shutdown", - "method": "shutdown", - "params": null - }, - "wait": [ - { - "id": "shutdown", - "result": null - } - ] - } - }, - { - "send": { - "request": { - "jsonrpc": "2.0", - "method": "exit" - }, - "wait": [] - } - }, - { - "stop": { - "exit_code": 0 - } - } -] \ No newline at end of file diff --git a/testsuite/gpr_lsp/import_using_space_string/windows/test.yaml b/testsuite/gpr_lsp/import_using_space_string/windows/test.yaml deleted file mode 100644 index 042f35bfc..000000000 --- a/testsuite/gpr_lsp/import_using_space_string/windows/test.yaml +++ /dev/null @@ -1,3 +0,0 @@ -title: 'check with " "; support' -skip: - - ['SKIP', 'env.build.os.name not in ("windows")'] diff --git a/testsuite/gpr_lsp/invalid_file_name_support/others/test.yaml b/testsuite/gpr_lsp/invalid_file_name_support/others/test.yaml deleted file mode 100644 index e0d2d5dc0..000000000 --- a/testsuite/gpr_lsp/invalid_file_name_support/others/test.yaml +++ /dev/null @@ -1,3 +0,0 @@ -title: 'check invalid filename handling' -skip: - - ['SKIP', 'env.build.os.name in ("windows")'] diff --git a/testsuite/gpr_lsp/invalid_file_name_support/others/prj.gpr b/testsuite/gpr_lsp/invalid_file_name_support/prj.gpr similarity index 100% rename from testsuite/gpr_lsp/invalid_file_name_support/others/prj.gpr rename to testsuite/gpr_lsp/invalid_file_name_support/prj.gpr diff --git a/testsuite/gpr_lsp/invalid_file_name_support/others/test.json b/testsuite/gpr_lsp/invalid_file_name_support/test.json similarity index 100% rename from testsuite/gpr_lsp/invalid_file_name_support/others/test.json rename to testsuite/gpr_lsp/invalid_file_name_support/test.json diff --git a/testsuite/gpr_lsp/invalid_file_name_support/test.yaml b/testsuite/gpr_lsp/invalid_file_name_support/test.yaml new file mode 100644 index 000000000..7fbe73d0e --- /dev/null +++ b/testsuite/gpr_lsp/invalid_file_name_support/test.yaml @@ -0,0 +1,2 @@ +title: 'check invalid filename handling' + diff --git a/testsuite/gpr_lsp/invalid_file_name_support/windows/prj.gpr b/testsuite/gpr_lsp/invalid_file_name_support/windows/prj.gpr deleted file mode 100644 index f677aa6f2..000000000 --- a/testsuite/gpr_lsp/invalid_file_name_support/windows/prj.gpr +++ /dev/null @@ -1,4 +0,0 @@ -with " "; -aggregate project prj extends " " is -for Project_Files use (" "); -end prj; diff --git a/testsuite/gpr_lsp/invalid_file_name_support/windows/test.json b/testsuite/gpr_lsp/invalid_file_name_support/windows/test.json deleted file mode 100644 index bd96e1dae..000000000 --- a/testsuite/gpr_lsp/invalid_file_name_support/windows/test.json +++ /dev/null @@ -1,453 +0,0 @@ -[ - { - "comment": [ - "test invalid filename support" - ] - }, - { - "start": { - "cmd": [ - "${ALS}", - "--language-gpr" - ] - } - }, - { - "send": { - "request": { - "jsonrpc": "2.0", - "id": "init", - "method": "initialize", - "params": { - "processId": 441587, - "rootUri": "$URI{.}", - "capabilities": { - "workspace": { - "applyEdit": true, - "workspaceEdit": {}, - "didChangeConfiguration": {}, - "didChangeWatchedFiles": {}, - "executeCommand": {} - }, - "textDocument": { - "synchronization": {}, - "completion": { - "dynamicRegistration": true, - "completionItem": { - "snippetSupport": true, - "documentationFormat": [ - "plaintext", - "markdown" - ] - } - }, - "hover": {}, - "definition": {}, - "documentSymbol": { - "hierarchicalDocumentSymbolSupport": true - } - } - } - } - }, - "wait": [ - { - "jsonrpc": "2.0", - "id": "init", - "result": { - "capabilities": { - "textDocumentSync": { - "openClose": true, - "change": 1 - }, - "completionProvider": { - "triggerCharacters": [ - " " - ], - "resolveProvider": true - }, - "hoverProvider": true, - "definitionProvider": true, - "documentSymbolProvider": {} - } - } - } - ] - } - }, - { - "send": { - "request": { - "jsonrpc": "2.0", - "method": "initialized" - }, - "wait": [] - } - }, - { - "send": { - "request": { - "jsonrpc": "2.0", - "method": "textDocument/didOpen", - "params": { - "textDocument": { - "uri": "$URI{prj.gpr}", - "languageId": "gpr", - "version": 1, - "text": "with \" \";\naggregate project prj extends \" \" is\nfor Project_Files use (\" \");\nend prj;\n" - } - } - }, - "wait": [ - { - "jsonrpc": "2.0", - "method": "textDocument/publishDiagnostics", - "params": { - "uri": "$URI{prj.gpr}", - "diagnostics": [ - { - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 0 - } - }, - "severity": 1, - - "message": "GPR parser unexpected ADA.IO_EXCEPTIONS.NAME_ERROR invalid path name \" \"" - } - ] - } - } - ] - } - }, - { - "send": { - "request": { - "jsonrpc": "2.0", - "id": "textDocument/documentSymbol_prj_1", - "method": "textDocument/documentSymbol", - "params": { - "textDocument": { - "uri": "$URI{prj.gpr}" - } - } - }, - "wait": [ - { - "jsonrpc": "2.0", - "id": "textDocument/documentSymbol_prj_1", - "result": [ - { - "name": "with clauses", - "kind": 3, - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 0 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 0 - } - }, - "children": [ - { - "name": " ", - "kind": 3, - "range": { - "start": { - "line": 0, - "character": 5 - }, - "end": { - "line": 0, - "character": 9 - } - }, - "selectionRange": { - "start": { - "line": 0, - "character": 5 - }, - "end": { - "line": 0, - "character": 9 - } - } - } - ] - }, - { - "name": "prj", - "kind": 2, - "range": { - "start": { - "line": 1, - "character": 10 - }, - "end": { - "line": 1, - "character": 17 - } - }, - "selectionRange": { - "start": { - "line": 1, - "character": 10 - }, - "end": { - "line": 1, - "character": 17 - } - }, - "children": [ - { - "name": "Project_Files", - "kind": 7, - "range": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 17 - } - }, - "selectionRange": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 17 - } - } - } - ] - } - ] - } - ] - } - }, - { - "send": { - "request": { - "jsonrpc": "2.0", - "id": "textDocument/hover_prj_0_7", - "method": "textDocument/hover", - "params": { - "textDocument": { - "uri": "$URI{prj.gpr}" - }, - "position": { - "line": 0, - "character": 7 - } - } - }, - "wait": [ - { - "jsonrpc": "2.0", - "id": "textDocument/hover_prj_0_7", - "result": null - } - ] - } - }, - { - "send": { - "request": { - "params": { - "position": { - "line": 0, - "character": 7 - }, - "textDocument": { - "uri": "$URI{prj.gpr}" - } - }, - "jsonrpc": "2.0", - "id": "definition1", - "method": "textDocument/definition" - }, - "wait": [ - { - "id": "definition1", - "result": [] - } - ] - } - }, - { - "send": { - "request": { - "jsonrpc": "2.0", - "id": "textDocument/hover_prj_1_32", - "method": "textDocument/hover", - "params": { - "textDocument": { - "uri": "$URI{prj.gpr}" - }, - "position": { - "line": 1, - "character": 32 - } - } - }, - "wait": [ - { - "jsonrpc": "2.0", - "id": "textDocument/hover_prj_1_32", - "result": null - } - ] - } - }, - { - "send": { - "request": { - "jsonrpc": "2.0", - "id": "textDocument/definition_prj_1_32", - "method": "textDocument/definition", - "params": { - "textDocument": { - "uri": "$URI{prj.gpr}" - }, - "position": { - "line": 1, - "character": 32 - } - } - }, - "wait": [ - { - "jsonrpc": "2.0", - "id": "textDocument/definition_prj_1_32", - "result": [] - } - ] - } - }, - { - "send": { - "request": { - "jsonrpc": "2.0", - "id": "textDocument/hover_prj_2_25", - "method": "textDocument/hover", - "params": { - "textDocument": { - "uri": "$URI{prj.gpr}" - }, - "position": { - "line": 2, - "character": 25 - } - } - }, - "wait": [ - { - "jsonrpc": "2.0", - "id": "textDocument/hover_prj_2_25", - "result": null - } - ] - } - }, - { - "send": { - "request": { - "jsonrpc": "2.0", - "id": "textDocument/definition_prj_2_25", - "method": "textDocument/definition", - "params": { - "textDocument": { - "uri": "$URI{prj.gpr}" - }, - "position": { - "line": 2, - "character": 25 - } - } - }, - "wait": [ - { - "jsonrpc": "2.0", - "id": "textDocument/definition_prj_2_25", - "result": [] - } - ] - } - }, - { - "send": { - "request": { - "jsonrpc": "2.0", - "method": "textDocument/didClose", - "params": { - "textDocument": { - "uri": "$URI{prj.gpr}" - } - } - }, - "wait": [ - { - "jsonrpc": "2.0", - "method": "textDocument/publishDiagnostics", - "params": { - "uri": "$URI{prj.gpr}", - "diagnostics": [] - } - } - ] - } - }, - { - "send": { - "request": { - "jsonrpc": "2.0", - "id": "shutdown", - "method": "shutdown", - "params": null - }, - "wait": [ - { - "id": "shutdown", - "result": null - } - ] - } - }, - { - "send": { - "request": { - "jsonrpc": "2.0", - "method": "exit" - }, - "wait": [] - } - }, - { - "stop": { - "exit_code": 0 - } - } -] \ No newline at end of file diff --git a/testsuite/gpr_lsp/invalid_file_name_support/windows/test.yaml b/testsuite/gpr_lsp/invalid_file_name_support/windows/test.yaml deleted file mode 100644 index ec17d5d21..000000000 --- a/testsuite/gpr_lsp/invalid_file_name_support/windows/test.yaml +++ /dev/null @@ -1,3 +0,0 @@ -title: 'check invalid filename handling' -skip: - - ['SKIP', 'env.build.os.name not in ("windows")']