Wrong attribute definition in GLS external tool

Add a test.

Closes eng/ide/gnatstudio#394
This commit is contained in:
Boulanger
2024-10-11 13:18:11 +02:00
committed by Adrien Boulanger
parent c6deb70255
commit 31450ac803
4 changed files with 150 additions and 4 deletions

View File

@@ -544,8 +544,8 @@ package body LSP.GPR_External_Tools is
"list of switches to be used when invoking 'gnatcheck' for a " &
"source of the language, if there is no applicable attribute " &
"Switches.",
Index_Type => PRA.No_Index,
Value => Single,
Index_Type => PRA.String_Index,
Value => List,
Value_Case_Sensitive => True);
Add_Attribute
@@ -554,8 +554,8 @@ package body LSP.GPR_External_Tools is
Description => "Index is a source file name. Value is " &
"the list of switches to be used when invoking 'gnatcheck' for " &
"the source.",
Index_Type => PRA.No_Index,
Value => Single,
Index_Type => PRA.String_Index,
Value => List,
Value_Case_Sensitive => True);
end Import_GNATcheck_Attributes;

View File

@@ -0,0 +1,6 @@
project prj is
package Check is
for Default_Switches ("ada") use ("-j8");
for Switches ("ada") use ("-k");
end Check;
end prj;

View File

@@ -0,0 +1,139 @@
[
{
"comment": [
"Test attribute checking for the GNATcheck package"
]
},
{
"start": {
"cmd": ["${ALS}", "--language-gpr"]
}
},
{
"send": {
"request": {
"params": {
"capabilities": {
},
"rootUri": "$URI{.}"
},
"id": 1,
"method": "initialize"
},
"wait": [{
"id": 1,
"result": {
"capabilities": {
"textDocumentSync": {
"openClose": true,
"change": 1
}
}
}
}]
}
},
{
"send": {
"request": {
"jsonrpc": "2.0",
"method": "initialized"
},
"wait": []
}
},
{
"send": {
"request": {
"params": {
"textDocument": {
"text": "project prj is\n package Check is\n for Default_Switches (\"ada\") use (\"-j8\");\n for Switches (\"ada\") use (\"-k\");\n end Check;\nend prj;",
"version": 0,
"uri": "$URI{prj.gpr}",
"languageId": "Gpr"
}
},
"jsonrpc": "2.0",
"method": "textDocument/didOpen"
},
"wait": [{
"method": "textDocument/publishDiagnostics",
"params": {
"uri": "$URI{prj.gpr}",
"diagnostics": []
}
}]
}
},
{
"send": {
"request": {
"jsonrpc": "2.0",
"method": "textDocument/didChange",
"params": {
"textDocument": {
"uri": "$URI{prj.gpr}",
"version": 1
},
"contentChanges": [
{
"range": {
"start": {
"line": 2,
"character": 27
},
"end": {
"line": 2,
"character": 34
}
},
"text": ""
}
]
}
},
"wait": [{
"method": "textDocument/publishDiagnostics",
"params": {
"uri": "$URI{prj.gpr}",
"diagnostics": [
{
"range": {
"start": {
"line": 2,
"character": 6
},
"end": {
"line": 2,
"character": 6
}
},
"severity": 1,
"message": "full associative array expression requires simple attribute reference"
}
]
}
}]
}
},
{
"send": {
"request": {
"jsonrpc": "2.0",
"id": 7,
"method": "shutdown"
},
"wait": [
{
"id": 7,
"result": null
}
]
}
},
{
"stop": {
"exit_code": 0
}
}
]

View File

@@ -0,0 +1 @@
title: 'gnatcheck_attributes'