Skip to content

Commit 2ded5a3

Browse files
Adapt tests to new GPR2 behavior regardings source/unit names
GPR2 does not handle units that don't match their source name anymore, so adapt the tests accordingly. For eng/ide/ada_language_server#1652
1 parent c957dca commit 2ded5a3

File tree

8 files changed

+75
-167
lines changed

8 files changed

+75
-167
lines changed

Diff for: testsuite/ada_lsp/did_rename_files/src1/foo.1.ada

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
package Bar is
1+
package Foo is
22

33
procedure Hello;
44

5-
end Hello;
5+
end Foo;

Diff for: testsuite/ada_lsp/did_rename_files/src2/foo.adb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
package body Bar is
1+
package body Foo is
22

33
procedure Hello is
44
begin
55
null;
66
end Hello;
77

8-
end Bar;
8+
end Foo;

Diff for: testsuite/ada_lsp/did_rename_files/test.json

+65-90
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
[
22
{
33
"comment": [
4-
"Test didRenameFiles notification"
5-
]
4+
"Test didRenameFiles notification when files renamed outside of ",
5+
"the ALS (e.g: via a shell command). All the subsequent requests are expected ",
6+
"to have null results since GPR2 does not support units that do not match ",
7+
"source names."
8+
]
69
},
710
{
811
"start": {
912
"cmd": ["${ALS}"]
1013
}
11-
}, {
14+
},
15+
{
1216
"send": {
1317
"request": {
1418
"jsonrpc": "2.0",
@@ -66,7 +70,7 @@
6670
"uri": "$URI{main.adb}",
6771
"languageId": "ada",
6872
"version": 1,
69-
"text": "with Bar;\nprocedure Main is\nbegin\n Bar.Hello;\nend Main;\n"
73+
"text": "with Foo;\nprocedure Main is\nbegin\n Foo.Hello;\nend Main;\n"
7074
}
7175
}
7276
},
@@ -110,14 +114,18 @@
110114
}
111115
},
112116
{
113-
"shell": ["mv",
114-
"${DIR}${DIR_SEP}src1${DIR_SEP}foo.1.ada",
115-
"${DIR}${DIR_SEP}src1${DIR_SEP}bar.1.ada"]
117+
"shell": [
118+
"mv",
119+
"${DIR}${DIR_SEP}src1${DIR_SEP}foo.1.ada",
120+
"${DIR}${DIR_SEP}src1${DIR_SEP}bar.1.ada"
121+
]
116122
},
117123
{
118-
"shell": ["mv",
119-
"${DIR}${DIR_SEP}src2${DIR_SEP}foo.adb",
120-
"${DIR}${DIR_SEP}src2${DIR_SEP}bar.adb"]
124+
"shell": [
125+
"mv",
126+
"${DIR}${DIR_SEP}src2${DIR_SEP}foo.adb",
127+
"${DIR}${DIR_SEP}src2${DIR_SEP}bar.adb"
128+
]
121129
},
122130
{
123131
"send": {
@@ -141,68 +149,52 @@
141149
}
142150
},
143151
{
144-
"send": {
145-
"request": {
146-
"jsonrpc":"2.0",
147-
"id": 5,
148-
"method":"workspace/executeCommand",
149-
"params":{
150-
"command": "als-other-file",
151-
"arguments": [
152-
{
153-
"uri": "$URI{src1/bar.1.ada}"
154-
}
155-
]
156-
}
157-
},
158-
"wait":[
159-
{
160-
"jsonrpc": "2.0",
161-
"method": "window/showDocument",
162-
"params": {
163-
"uri": "$URI{src2/bar.adb}",
164-
"takeFocus": true
165-
}
166-
},
167-
{
168-
"jsonrpc": "2.0",
169-
"id": 5,
170-
"result": null
171-
}
172-
]
173-
}
174-
},
175-
{
176-
"send": {
177-
"request": {
178-
"jsonrpc":"2.0",
179-
"id": 6,
180-
"method":"workspace/executeCommand",
181-
"params":{
182-
"command": "als-other-file",
183-
"arguments": [
184-
{
185-
"uri": "$URI{src1/bar.1.ada}"
186-
}
187-
]
188-
}
189-
},
190-
"wait":[
191-
{
192-
"jsonrpc": "2.0",
193-
"method": "window/showDocument",
194-
"params": {
195-
"uri": "$URI{src2/bar.adb}",
196-
"takeFocus": true
197-
}
198-
},
199-
{
200-
"jsonrpc": "2.0",
201-
"id": 6,
202-
"result": null
203-
}
204-
]
205-
}
152+
"send": {
153+
"request": {
154+
"jsonrpc": "2.0",
155+
"id": 5,
156+
"method": "workspace/executeCommand",
157+
"params": {
158+
"command": "als-other-file",
159+
"arguments": [
160+
{
161+
"uri": "$URI{src1/bar.1.ada}"
162+
}
163+
]
164+
}
165+
},
166+
"wait": [
167+
{
168+
"jsonrpc": "2.0",
169+
"id": 5,
170+
"result": null
171+
}
172+
]
173+
}
174+
},
175+
{
176+
"send": {
177+
"request": {
178+
"jsonrpc": "2.0",
179+
"id": 6,
180+
"method": "workspace/executeCommand",
181+
"params": {
182+
"command": "als-other-file",
183+
"arguments": [
184+
{
185+
"uri": "$URI{src1/bar.1.ada}"
186+
}
187+
]
188+
}
189+
},
190+
"wait": [
191+
{
192+
"jsonrpc": "2.0",
193+
"id": 6,
194+
"result": null
195+
}
196+
]
197+
}
206198
},
207199
{
208200
"send": {
@@ -220,24 +212,7 @@
220212
}
221213
}
222214
},
223-
"wait": [
224-
{
225-
"id": 4,
226-
"result": {
227-
"uri": "$URI{src1/bar.1.ada}",
228-
"range": {
229-
"start": {
230-
"line": 2,
231-
"character": 13
232-
},
233-
"end": {
234-
"line": 2,
235-
"character": 18
236-
}
237-
}
238-
}
239-
}
240-
]
215+
"wait": []
241216
}
242217
},
243218
{

Diff for: testsuite/ada_lsp/range_formatting/W103-015_GitHub-1073-1074/test.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"method": "textDocument/didOpen",
7373
"params": {
7474
"textDocument": {
75-
"uri": "$URI{foo.adb}",
75+
"uri": "$URI{debug.adb}",
7676
"languageId": "Ada",
7777
"version": 0,
7878
"text": "with -- context_clause_start\n Ada.Text_IO;\n\nprocedure Debug\nis begin\n null;\nend Debug;\n"
@@ -90,7 +90,7 @@
9090
"method": "textDocument/rangeFormatting",
9191
"params": {
9292
"textDocument": {
93-
"uri": "$URI{foo.adb}"
93+
"uri": "$URI{debug.adb}"
9494
},
9595
"options": {
9696
"tabSize": 8,
@@ -140,7 +140,7 @@
140140
"method": "textDocument/didClose",
141141
"params": {
142142
"textDocument": {
143-
"uri": "$URI{foo.adb}"
143+
"uri": "$URI{debug.adb}"
144144
}
145145
}
146146
},

Diff for: testsuite/ada_lsp/range_formatting/W103-015_GitHub-1086/test.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"method": "textDocument/didOpen",
7171
"params": {
7272
"textDocument": {
73-
"uri": "$URI{foo.adb}",
73+
"uri": "$URI{debug.adb}",
7474
"version": 0,
7575
"languageId": "Ada",
7676
"text": "procedure Debug\n is\n\nbegin\n E := (1 => --\n 'A');\nend Debug;\n"
@@ -88,7 +88,7 @@
8888
"method": "textDocument/rangeFormatting",
8989
"params": {
9090
"textDocument": {
91-
"uri": "$URI{foo.adb}"
91+
"uri": "$URI{debug.adb}"
9292
},
9393
"options": {
9494
"tabSize": 8,

Diff for: testsuite/gpr_lsp/completion_package_resolve/test.json

+1-68
Original file line numberDiff line numberDiff line change
@@ -399,30 +399,11 @@
399399
"result": {
400400
"isIncomplete": false,
401401
"items": [
402+
"<HAS>",
402403
{
403404
"label": "Builder",
404405
"data": ["Builder"]
405406
},
406-
{
407-
"label": "Clean",
408-
"data": ["Clean"]
409-
},
410-
{
411-
"label": "Gnatls",
412-
"data": ["Gnatls"]
413-
},
414-
{
415-
"label": "Install",
416-
"data": ["Install"]
417-
},
418-
{
419-
"label": "Remote",
420-
"data": ["Remote"]
421-
},
422-
{
423-
"label": "Format",
424-
"data": ["Format"]
425-
},
426407
{
427408
"label": "Pretty_Printer",
428409
"data": ["Pretty_Printer"]
@@ -431,58 +412,10 @@
431412
"label": "Ide",
432413
"data": ["Ide"]
433414
},
434-
{
435-
"label": "Ant",
436-
"data": ["Ant"]
437-
},
438-
{
439-
"label": "Make",
440-
"data": ["Make"]
441-
},
442-
{
443-
"label": "Analyzer",
444-
"data": ["Analyzer"]
445-
},
446-
{
447-
"label": "Check",
448-
"data": ["Check"]
449-
},
450-
{
451-
"label": "Codepeer",
452-
"data": ["Codepeer"]
453-
},
454415
{
455416
"label": "Coverage",
456417
"data": ["Coverage"]
457418
},
458-
{
459-
"label": "Dsa",
460-
"data": ["Dsa"]
461-
},
462-
{
463-
"label": "Documentation",
464-
"data": ["Documentation"]
465-
},
466-
{
467-
"label": "Emulator",
468-
"data": ["Emulator"]
469-
},
470-
{
471-
"label": "Gnattest",
472-
"data": ["Gnattest"]
473-
},
474-
{
475-
"label": "Prove",
476-
"data": ["Prove"]
477-
},
478-
{
479-
"label": "Qgen",
480-
"data": ["Qgen"]
481-
},
482-
{
483-
"label": "Stack",
484-
"data": ["Stack"]
485-
},
486419
{
487420
"label": "Stub",
488421
"data": ["Stub"]

0 commit comments

Comments
 (0)