Adapt tests to new GPR2 diagnostics

When GPR2 does not find an imported project, it now lists
all the searched directories in the reported diagnostic.

Adapt the tests to avoid matching the actual diagnostic's message,
since it can vary depending on the environment/machine.

For eng/ide/ada_language_server#1752
For eng/shared/anod#817
This commit is contained in:
Anthony Leonardo Gracio
2026-01-05 11:07:35 +00:00
parent 80ea282949
commit 2645d2a7d2
3 changed files with 127 additions and 99 deletions

View File

@@ -86,7 +86,13 @@
"version": 1,
"text": "with \" \";\nproject Prj is\nend Prj;"
}
}
},
"comment": [
"We expect one diagnostic about an invalid with clause. ",
"We don't want to match the actual message, since it lists all ",
"the directories searched to find the imported GPR project, which may ",
"vary depending on the environment and the machine."
]
},
"wait": [
{
@@ -107,7 +113,7 @@
}
},
"severity": 1,
"message": "imported project file \" .gpr\" not found"
"message": "<ANY>"
}
]
}

View File

@@ -86,7 +86,13 @@
"version": 1,
"text": "with \" \";\naggregate project prj extends \" \" is\nfor Project_Files use (\" \");\nend prj;\n"
}
}
},
"comment": [
"We expect one diagnostic about an invalid with clause. ",
"We don't want to match the actual message, since it lists all ",
"the directories searched to find the imported GPR project, which may ",
"vary depending on the environment and the machine."
]
},
"wait": [
{
@@ -107,7 +113,7 @@
}
},
"severity": 1,
"message": "imported project file \" .gpr\" not found"
"message": "<ANY>"
},
{
"range": {
@@ -121,7 +127,7 @@
}
},
"severity": 1,
"message": "extended project file \" .gpr\" not found"
"message": "<ANY>"
}
]
}

View File

@@ -1,86 +1,93 @@
[
{
"comment": [
"verify that diags are published for root & related projects"
]
},
"comment": ["verify that diags are published for root & related projects"]
},
{
"start": {
"cmd": ["${ALS}", "--language-gpr"]
"cmd": ["${ALS}", "--language-gpr"]
}
},
},
{
"send": {
"request": {
"params": {
"capabilities": {
},
"capabilities": {},
"rootUri": "$URI{.}"
},
"id": 1,
"method": "initialize"
},
"wait": [{
},
"id": 1,
"result": {
"capabilities": {
"textDocumentSync": {
"openClose": true,
"change": 1
"method": "initialize"
},
"wait": [
{
"id": 1,
"result": {
"capabilities": {
"textDocumentSync": {
"openClose": true,
"change": 1
}
}
}
}
}]
}
},
}
}
]
}
},
{
"send": {
"request": {
"jsonrpc": "2.0",
"jsonrpc": "2.0",
"method": "initialized"
},
},
"wait": []
}
},
},
{
"send": {
"request": {
"params": {
"textDocument": {
"text": "with \"doesnotexist\";\nproject prj is\nend prj;",
"version": 0,
"uri": "$URI{prj.gpr}",
"text": "with \"doesnotexist\";\nproject prj is\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": [
{
"range": {
"start": {
"line": 0,
"character": 5
},
"end": {
"line": 0,
"character": 5
}
},
"severity": 1,
"message": "imported project file \"doesnotexist.gpr\" not found"
}
]
},
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"comment": [
"We expect one diagnostic about an invalid with clause. ",
"We don't want to match the actual message, since it lists all ",
"the directories searched to find the imported GPR project, which may ",
"vary depending on the environment and the machine."
]
},
"wait": [
{
"method": "textDocument/publishDiagnostics",
"params": {
"uri": "$URI{prj.gpr}",
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 5
},
"end": {
"line": 0,
"character": 5
}
},
"severity": 1,
"message": "<ANY>"
}
]
}
}
}]
]
}
},
{
{
"send": {
"request": {
"jsonrpc": "2.0",
@@ -105,33 +112,41 @@
"text": "imported"
}
]
}
},
"comment": [
"We expect one diagnostic about an invalid with clause. ",
"We don't want to match the actual message, since it lists all ",
"the directories searched to find the imported GPR project, which may ",
"vary depending on the environment and the machine."
]
},
"wait": [{
"method": "textDocument/publishDiagnostics",
"params": {
"uri": "$URI{imported.gpr}",
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 5
},
"end": {
"line": 0,
"character": 5
}
},
"severity": 1,
"message": "imported project file \"doesnotexist.gpr\" not found"
}
]
"wait": [
{
"method": "textDocument/publishDiagnostics",
"params": {
"uri": "$URI{imported.gpr}",
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 5
},
"end": {
"line": 0,
"character": 5
}
},
"severity": 1,
"message": "<ANY>"
}
]
}
}
}]
]
}
},
{
"send": {
"request": {
@@ -139,35 +154,36 @@
"textDocument": {
"uri": "$URI{prj.gpr}"
}
},
"jsonrpc": "2.0",
},
"jsonrpc": "2.0",
"method": "textDocument/didClose"
},
"wait": [{
"method": "textDocument/publishDiagnostics",
"params": {
"uri": "$URI{prj.gpr}",
"diagnostics": [
]
},
"wait": [
{
"method": "textDocument/publishDiagnostics",
"params": {
"uri": "$URI{prj.gpr}",
"diagnostics": []
}
}
}]
]
}
},
},
{
"send": {
"request": {
"jsonrpc": "2.0",
"id": 7,
"jsonrpc": "2.0",
"id": 7,
"method": "shutdown"
},
},
"wait": [
{
"id": 7,
"id": 7,
"result": null
}
]
}
},
},
{
"stop": {
"exit_code": 0