Skip to content

Commit ebe452e

Browse files
committed
Add test for textDocument/definition method
1 parent 4e40555 commit ebe452e

File tree

4 files changed

+137
-1
lines changed

4 files changed

+137
-1
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ check: all
2424
$(TESTER) $(TD)/0001-start_stop.json
2525
$(TESTER) $(TD)/0002-shutdown.json
2626
$(TESTER) $(TD)/0003-get_symbols.json
27+
$(TESTER) $(TD)/def_name.json
2728
@echo All test passed!
2829

2930
deploy: check

integration/travis/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function darwin_deploy()
4848
/usr/local/opt/gmp/lib/libgmp.10
4949
do
5050
cp -v $J.dylib $DIR
51-
drop_rpath $DIR/$J.dylib
51+
drop_rpath $DIR/`basename $J.dylib`
5252
done
5353

5454
for J in $DIR/libgnatcoll_gmp.dylib $DIR/ada_language_server; do

testsuite/ada_lsp/def_name.json

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
[
2+
{
3+
"start": {
4+
"cmd": [".obj/server/ada_language_server"]
5+
}
6+
}, {
7+
"send": {
8+
"request": {"jsonrpc":"2.0","id":0,"method":"initialize","params":{
9+
"processId":1,
10+
"rootUri":"file://${TD}/def_name",
11+
"capabilities":{}}
12+
},
13+
"wait":[{ "id": 0,
14+
"result":{
15+
"capabilities":{
16+
"textDocumentSync":1,
17+
"definitionProvider":true
18+
}
19+
}
20+
}]
21+
}
22+
}, {
23+
"send": {
24+
"request": {
25+
"jsonrpc":"2.0",
26+
"method":"workspace/didChangeConfiguration",
27+
"params":{
28+
"settings":{
29+
}
30+
}
31+
},
32+
"wait":[]
33+
}
34+
}, {
35+
"send": {
36+
"request": {
37+
"jsonrpc":"2.0",
38+
"method":"textDocument/didOpen",
39+
"params":{
40+
"textDocument": {
41+
"uri": "file://${TD}/def_name/aaa.adb",
42+
"languageId": "ada",
43+
"version": 1,
44+
"text": "with Ada.Text_IO;\nprocedure Aaa is\nbegin\n Ada.Text_IO.New_Line;\n Aaa;\nend Aaa;\n"
45+
}
46+
}
47+
},
48+
"wait":[]
49+
}
50+
}, {
51+
"send": {
52+
"request": {
53+
"jsonrpc":"2.0",
54+
"id":"defname-1",
55+
"method":"textDocument/definition",
56+
"params":{
57+
"textDocument": {
58+
"uri": "file://${TD}/def_name/aaa.adb"
59+
},
60+
"position": {
61+
"line": 4,
62+
"character": 5
63+
}
64+
}
65+
},
66+
"wait":[{
67+
"id": "defname-1",
68+
"result":[{
69+
"uri": "file://${TD}/def_name/aaa.adb",
70+
"range": {
71+
"start": {
72+
"line": 1,
73+
"character": 10
74+
},
75+
"end": {
76+
"line": 1,
77+
"character": 13
78+
}
79+
}
80+
}]
81+
}]
82+
}
83+
}, {
84+
"send": {
85+
"request": {
86+
"jsonrpc":"2.0",
87+
"id":"defname-2",
88+
"method":"textDocument/definition",
89+
"params":{
90+
"textDocument": {
91+
"uri": "file://${TD}/def_name/aaa.adb"
92+
},
93+
"position": {
94+
"line": 3,
95+
"character": 18
96+
}
97+
}
98+
},
99+
"wait":[{
100+
"id": "defname-2",
101+
"result":[{
102+
"range": {
103+
"start": {},
104+
"end": {}
105+
}
106+
}]
107+
}]
108+
}
109+
}, {
110+
"send": {
111+
"request": {
112+
"jsonrpc":"2.0",
113+
"id": "shutdown",
114+
"method":"shutdown",
115+
"params":null
116+
},
117+
"wait":[{ "id": "shutdown" }]
118+
}
119+
}, {
120+
"send": {
121+
"request": {"jsonrpc":"2.0", "method":"exit", "params":{}},
122+
"wait":[]
123+
}
124+
}, {
125+
"stop": {
126+
"exit_code": 0
127+
}
128+
}
129+
]

testsuite/ada_lsp/def_name/aaa.adb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
with Ada.Text_IO;
2+
procedure Aaa is
3+
begin
4+
Ada.Text_IO.New_Line;
5+
Aaa;
6+
end Aaa;

0 commit comments

Comments
 (0)