Bump version to 19.1.0git
[llvm-project.git] / clang-tools-extra / clangd / test / type-hierarchy.test
blob69751000a7c6c09e465c2bc998ff825cafb81923
1 # RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
2 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
3 ---
4 {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"struct Parent {};\nstruct Child1 : Parent {};\nstruct Child2 : Child1 {};\nstruct Child3 : Child2 {};\nstruct Child4 : Child3 {};"}}}
5 ---
6 {"jsonrpc":"2.0","id":1,"method":"textDocument/prepareTypeHierarchy","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":11},"direction":2,"resolve":1}}
7 #      CHECK:  "id": 1
8 # CHECK-NEXT:  "jsonrpc": "2.0",
9 # CHECK-NEXT:  "result": [
10 # CHECK-NEXT:     {
11 # CHECK-NEXT:       "data": {
12 # CHECK-NEXT:         "parents": [
13 # CHECK-NEXT:          {
14 # CHECK-NEXT:           "parents": [
15 # CHECK-NEXT:             {
16 # CHECK-NEXT:              "parents": [],
17 # CHECK-NEXT:              "symbolID": "FE546E7B648D69A7"
18 # CHECK-NEXT:             }
19 # CHECK-NEXT:           ],
20 # CHECK-NEXT:           "symbolID": "ECDC0C46D75120F4"
21 # CHECK-NEXT:          }
22 # CHECK-NEXT:        ],
23 # CHECK-NEXT:        "symbolID": "8A991335E4E67D08"
24 # CHECK-NEXT:       },
25 # CHECK-NEXT:       "kind": 23,
26 # CHECK-NEXT:       "name": "Child2",
27 # CHECK-NEXT:       "range": {
28 # CHECK-NEXT:         "end": {
29 # CHECK-NEXT:           "character": 25,
30 # CHECK-NEXT:           "line": 2
31 # CHECK-NEXT:         },
32 # CHECK-NEXT:         "start": {
33 # CHECK-NEXT:           "character": 0,
34 # CHECK-NEXT:           "line": 2
35 # CHECK-NEXT:         }
36 # CHECK-NEXT:       },
37 # CHECK-NEXT:       "selectionRange": {
38 # CHECK-NEXT:         "end": {
39 # CHECK-NEXT:           "character": 13,
40 # CHECK-NEXT:           "line": 2
41 # CHECK-NEXT:         },
42 # CHECK-NEXT:         "start": {
43 # CHECK-NEXT:           "character": 7,
44 # CHECK-NEXT:           "line": 2
45 # CHECK-NEXT:         }
46 # CHECK-NEXT:       },
47 # CHECK-NEXT:       "uri": "file://{{.*}}/clangd-test/main.cpp"
48 # CHECK-NEXT:     }
49 # CHECK-NEXT:   ]
50 ---
51 {"jsonrpc":"2.0","id":2,"method":"typeHierarchy/supertypes","params":{"item":{"uri":"test:///main.cpp","data":{"parents":[{"parents":[{"parents":[],"symbolID":"FE546E7B648D69A7"}],"symbolID":"ECDC0C46D75120F4"}],"symbolID":"8A991335E4E67D08"},"name":"Child2","kind":23,"range":{"end":{"character":13,"line":3},"start":{"character":7,"line":3}},"selectionRange":{"end":{"character":13,"line":3},"start":{"character":7,"line":3}}}}}
52 #      CHECK:  "id": 2
53 # CHECK-NEXT:  "jsonrpc": "2.0",
54 # CHECK-NEXT:  "result": [
55 # CHECK-NEXT:     {
56 # CHECK-NEXT:       "data": {
57 # CHECK-NEXT:         "parents": [
58 # CHECK-NEXT:           {
59 # CHECK-NEXT:            "parents": [],
60 # CHECK-NEXT:            "symbolID": "FE546E7B648D69A7"
61 # CHECK-NEXT:           }
62 # CHECK-NEXT:         ],
63 # CHECK-NEXT:         "symbolID": "ECDC0C46D75120F4"
64 # CHECK-NEXT:       },
65 # CHECK-NEXT:       "kind": 23,
66 # CHECK-NEXT:       "name": "Child1",
67 # CHECK-NEXT:       "range": {
68 # CHECK-NEXT:         "end": {
69 # CHECK-NEXT:           "character": 13,
70 # CHECK-NEXT:           "line": 1
71 # CHECK-NEXT:         },
72 # CHECK-NEXT:         "start": {
73 # CHECK-NEXT:           "character": 7,
74 # CHECK-NEXT:           "line": 1
75 # CHECK-NEXT:         }
76 # CHECK-NEXT:       },
77 # CHECK-NEXT:       "selectionRange": {
78 # CHECK-NEXT:         "end": {
79 # CHECK-NEXT:           "character": 13,
80 # CHECK-NEXT:           "line": 1
81 # CHECK-NEXT:         },
82 # CHECK-NEXT:         "start": {
83 # CHECK-NEXT:           "character": 7,
84 # CHECK-NEXT:           "line": 1
85 # CHECK-NEXT:         }
86 # CHECK-NEXT:       },
87 # CHECK-NEXT:       "uri": "file://{{.*}}/clangd-test/main.cpp"
88 # CHECK-NEXT:     }
89 # CHECK-NEXT:  ]
90 ---
91 {"jsonrpc":"2.0","id":2,"method":"typeHierarchy/subtypes","params":{"item":{"uri":"test:///main.cpp","data":{"parents":[{"parents":[{"parents":[],"symbolID":"FE546E7B648D69A7"}],"symbolID":"ECDC0C46D75120F4"}],"symbolID":"8A991335E4E67D08"},"name":"Child2","kind":23,"range":{"end":{"character":13,"line":3},"start":{"character":7,"line":3}},"selectionRange":{"end":{"character":13,"line":3},"start":{"character":7,"line":3}}}}}
92 #      CHECK:  "id": 2
93 # CHECK-NEXT:  "jsonrpc": "2.0",
94 # CHECK-NEXT:  "result": [
95 # CHECK-NEXT:     {
96 # CHECK-NEXT:       "data": {
97 # CHECK-NEXT:         "parents": [
98 # CHECK-NEXT:          {
99 # CHECK-NEXT:           "parents": [
100 # CHECK-NEXT:            {
101 # CHECK-NEXT:             "parents": [
102 # CHECK-NEXT:               {
103 # CHECK-NEXT:                "parents": [],
104 # CHECK-NEXT:                "symbolID": "FE546E7B648D69A7"
105 # CHECK-NEXT:               }
106 # CHECK-NEXT:             ],
107 # CHECK-NEXT:             "symbolID": "ECDC0C46D75120F4"
108 # CHECK-NEXT:            }
109 # CHECK-NEXT:           ],
110 # CHECK-NEXT:           "symbolID": "8A991335E4E67D08"
111 # CHECK-NEXT:         }
112 # CHECK-NEXT:        ],
113 # CHECK-NEXT:        "symbolID": "A6576FE083F2949A"
114 # CHECK-NEXT:       },
115 # CHECK-NEXT:       "kind": 23,
116 # CHECK-NEXT:       "name": "Child3",
117 # CHECK-NEXT:       "range": {
118 # CHECK-NEXT:         "end": {
119 # CHECK-NEXT:           "character": 13,
120 # CHECK-NEXT:           "line": 3
121 # CHECK-NEXT:         },
122 # CHECK-NEXT:         "start": {
123 # CHECK-NEXT:           "character": 7,
124 # CHECK-NEXT:           "line": 3
125 # CHECK-NEXT:         }
126 # CHECK-NEXT:       },
127 # CHECK-NEXT:       "selectionRange": {
128 # CHECK-NEXT:         "end": {
129 # CHECK-NEXT:           "character": 13,
130 # CHECK-NEXT:           "line": 3
131 # CHECK-NEXT:         },
132 # CHECK-NEXT:         "start": {
133 # CHECK-NEXT:           "character": 7,
134 # CHECK-NEXT:           "line": 3
135 # CHECK-NEXT:         }
136 # CHECK-NEXT:       },
137 # CHECK-NEXT:       "uri": "file://{{.*}}/clangd-test/main.cpp"
138 # CHECK-NEXT:     }
139 # CHECK-NEXT:  ]
141 {"jsonrpc":"2.0","id":3,"method":"shutdown"}
143 {"jsonrpc":"2.0","method":"exit"}