Skip to content

Commit 7b8a0b6

Browse files
Add test sorting a prelude slice
1 parent d40b0a6 commit 7b8a0b6

File tree

10 files changed

+371
-0
lines changed

10 files changed

+371
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package Bar is
2+
end Bar;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package Corge is
2+
end Corge;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
project Default is
2+
for Main use ("main.adb");
3+
end Default;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package Foo is
2+
end Foo;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
with Main_Package;
2+
3+
procedure Main is
4+
begin
5+
null;
6+
end Main;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package body Main_Package is
2+
begin
3+
null;
4+
end Main_Package;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
pragma Ada_2012;
2+
3+
-- Comment 1
4+
with Ada.Containers; -- Comment 2
5+
-- Comment 3
6+
private with Ada.Finalization; -- Comment 4
7+
-- Comment 5
8+
with Ada.Strings.Unbounded; -- Comment 6
9+
private with Ada.Unchecked_Deallocation; -- Comment 7
10+
-- Comment 8
11+
12+
-- Comment 9
13+
-- Comment 10
14+
private with Qux; -- Comment 11
15+
pragma Elaborate (Qux); -- Comment 12
16+
17+
-- Comment 13
18+
-- Comment 14
19+
20+
-- Comment 15
21+
22+
-- Comment 16
23+
-- Comment 17
24+
-- Comment 18
25+
with Foo; -- Comment 19
26+
pragma Elaborate_All (Foo);
27+
pragma Warnings (Off, -- Comment 20
28+
Foo); -- Comment 21
29+
-- Comment 22
30+
31+
limited with Corge;
32+
-- Comment 23
33+
with Bar; use Bar; -- Comment 24
34+
-- Comment 25
35+
pragma Warnings (Off, -- Comment 26
36+
Bar);
37+
38+
use Foo;
39+
-- Comment 27
40+
-- Comment 28
41+
42+
with Ada.Strings;
43+
with Ada.Containers.Vectors;
44+
with Ada.Containers.Hashed_Sets;
45+
46+
with Ada.Strings.Hash;
47+
-- Comment 29
48+
-- Comment 30
49+
50+
51+
52+
package Main_Package is
53+
pragma Elaborate_Body;
54+
55+
end Main_Package;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package Qux is
2+
end Qux;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,294 @@
1+
[
2+
{
3+
"comment": [
4+
"Checks that Sort Dependencies refactoring code action is correctly provided and executed when a prelude range is selected."
5+
]
6+
},
7+
{
8+
"start": {
9+
"cmd": [
10+
"${ALS}"
11+
]
12+
}
13+
},
14+
{
15+
"send": {
16+
"request": {
17+
"jsonrpc": "2.0",
18+
"id": 0,
19+
"method": "initialize",
20+
"params": {
21+
"processId": 59002,
22+
"locale": "en-gb",
23+
"rootPath": "$URI{.}",
24+
"rootUri": "$URI{.}",
25+
"capabilities": {
26+
"workspace": {
27+
"applyEdit": true,
28+
"workspaceEdit": {
29+
"documentChanges": true,
30+
"resourceOperations": [
31+
"create",
32+
"rename",
33+
"delete"
34+
]
35+
},
36+
"executeCommand": {
37+
"dynamicRegistration": true
38+
}
39+
},
40+
"textDocument": {
41+
"codeAction": {
42+
"dynamicRegistration": true,
43+
"codeActionLiteralSupport": {
44+
"codeActionKind": {
45+
"valueSet": [
46+
"refactor",
47+
"refactor.extract",
48+
"refactor.inline",
49+
"refactor.rewrite"
50+
]
51+
}
52+
}
53+
}
54+
},
55+
"experimental": {
56+
"advanced_refactorings": [
57+
"replace_type"
58+
]
59+
}
60+
}
61+
}
62+
},
63+
"wait": [
64+
{
65+
"jsonrpc": "2.0",
66+
"id": 0,
67+
"result": {
68+
"capabilities": {
69+
"codeActionProvider": {
70+
"codeActionKinds": [
71+
"<HAS>",
72+
"refactor.rewrite"
73+
]
74+
},
75+
"executeCommandProvider": {
76+
"commands": [
77+
"<HAS>",
78+
"als-refactor-sort_dependencies"
79+
]
80+
}
81+
}
82+
}
83+
}
84+
]
85+
}
86+
},
87+
{
88+
"send": {
89+
"request": {
90+
"jsonrpc": "2.0",
91+
"method": "workspace/didChangeConfiguration",
92+
"params": {
93+
"settings": {
94+
"ada": {
95+
"trace": {
96+
"server": "off"
97+
},
98+
"projectFile": "default.gpr",
99+
"scenarioVariables": {},
100+
"defaultCharset": "iso-8859-1",
101+
"displayMethodAncestryOnNavigation": "usage_and_abstract_only",
102+
"enableDiagnostics": true,
103+
"useCompletionSnippets": false,
104+
"renameInComments": false
105+
}
106+
}
107+
}
108+
},
109+
"wait": [
110+
{
111+
"jsonrpc": "2.0",
112+
"id": 1,
113+
"method": "window/workDoneProgress/create",
114+
"params": {
115+
"token": "<ANY>"
116+
}
117+
}
118+
]
119+
}
120+
},
121+
{
122+
"send": {
123+
"request": {
124+
"jsonrpc": "2.0",
125+
"method": "initialized",
126+
"params": {}
127+
},
128+
"wait": []
129+
}
130+
},
131+
{
132+
"send": {
133+
"request": {
134+
"jsonrpc": "2.0",
135+
"method": "textDocument/didOpen",
136+
"params": {
137+
"textDocument": {
138+
"uri": "$URI{main_package.ads}",
139+
"languageId": "ada",
140+
"version": 1,
141+
"text": "pragma Ada_2012;\n\n-- Comment 1\nwith Ada.Containers; -- Comment 2\n-- Comment 3\nprivate with Ada.Finalization; -- Comment 4\n-- Comment 5\nwith Ada.Strings.Unbounded; -- Comment 6\nprivate with Ada.Unchecked_Deallocation; -- Comment 7\n-- Comment 8\n\n-- Comment 9\n-- Comment 10\nprivate with Qux; -- Comment 11\npragma Elaborate (Qux); -- Comment 12\n\n-- Comment 13\n-- Comment 14\n\n-- Comment 15\n\n-- Comment 16\n-- Comment 17\n-- Comment 18\nwith Foo; -- Comment 19\npragma Elaborate_All (Foo);\npragma Warnings (Off, -- Comment 20\n Foo); -- Comment 21\n-- Comment 22\n\nlimited with Corge;\n-- Comment 23\nwith Bar; use Bar; -- Comment 24\n-- Comment 25\npragma Warnings (Off, -- Comment 26\n Bar);\n\nuse Foo;\n-- Comment 27\n-- Comment 28\n\nwith Ada.Strings;\nwith Ada.Containers.Vectors;\nwith Ada.Containers.Hashed_Sets;\n\nwith Ada.Strings.Hash;\n-- Comment 29\n-- Comment 30\n\n\n\npackage Main_Package is\n pragma Elaborate_Body;\n\nend Main_Package;\n"
142+
}
143+
}
144+
},
145+
"wait": []
146+
}
147+
},
148+
{
149+
"send": {
150+
"request": {
151+
"jsonrpc": "2.0",
152+
"id": 1,
153+
"method": "textDocument/codeAction",
154+
"params": {
155+
"textDocument": {
156+
"uri": "$URI{main_package.ads}"
157+
},
158+
"range": {
159+
"start": {
160+
"line": 41,
161+
"character": 1
162+
},
163+
"end": {
164+
"line": 43,
165+
"character": 3
166+
}
167+
},
168+
"context": {
169+
"diagnostics": []
170+
}
171+
}
172+
},
173+
"wait": [
174+
{
175+
"jsonrpc": "2.0",
176+
"id": 1,
177+
"result": [
178+
{
179+
"title": "Sort Dependencies",
180+
"kind": "refactor",
181+
"command": {
182+
"title": "",
183+
"command": "als-refactor-sort_dependencies",
184+
"arguments": [
185+
{
186+
"context": "Default",
187+
"where": {
188+
"uri": "$URI{main_package.ads}",
189+
"range": {
190+
"start": {
191+
"line": 41,
192+
"character": 1
193+
},
194+
"end": {
195+
"line": 43,
196+
"character": 3
197+
}
198+
}
199+
}
200+
}
201+
]
202+
}
203+
}
204+
]
205+
}
206+
]
207+
}
208+
},
209+
{
210+
"send": {
211+
"request": {
212+
"jsonrpc": "2.0",
213+
"id": 3,
214+
"method": "workspace/executeCommand",
215+
"params": {
216+
"command": "als-refactor-sort_dependencies",
217+
"arguments": [
218+
{
219+
"context": "Default",
220+
"where": {
221+
"uri": "$URI{main_package.ads}",
222+
"range": {
223+
"start": {
224+
"line": 41,
225+
"character": 1
226+
},
227+
"end": {
228+
"line": 43,
229+
"character": 3
230+
}
231+
}
232+
}
233+
}
234+
]
235+
}
236+
},
237+
"wait": [
238+
{
239+
"jsonrpc": "2.0",
240+
"id": 2,
241+
"method": "workspace/applyEdit",
242+
"params": {
243+
"label": "Sort Dependencies",
244+
"edit": {
245+
"documentChanges": [
246+
{
247+
"textDocument": {
248+
"uri": "$URI{main_package.ads}",
249+
"version": 1
250+
},
251+
"edits": [
252+
{
253+
"range": {
254+
"start": {
255+
"line": 41,
256+
"character": 0
257+
},
258+
"end": {
259+
"line": 43,
260+
"character": 32
261+
}
262+
},
263+
"newText": "with Ada.Containers.Hashed_Sets;\nwith Ada.Containers.Vectors;\nwith Ada.Strings;"
264+
}
265+
]
266+
}
267+
]
268+
}
269+
}
270+
}
271+
]
272+
}
273+
},
274+
{
275+
"send": {
276+
"request": {
277+
"jsonrpc": "2.0",
278+
"id": 4,
279+
"method": "shutdown"
280+
},
281+
"wait": [
282+
{
283+
"id": 4,
284+
"result": null
285+
}
286+
]
287+
}
288+
},
289+
{
290+
"stop": {
291+
"exit_code": 0
292+
}
293+
}
294+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
title: 'refactoring_sort_dependencies/SA22-035'

0 commit comments

Comments
 (0)