|
1 |
| -# RUN: not clangd -pretty -sync -enable-test-uri-scheme < %s | FileCheck -strict-whitespace %s |
2 |
| -# RUN: not clangd -pretty -sync -enable-test-uri-scheme < %s 2>&1 | FileCheck -check-prefix=STDERR %s |
3 |
| -# vim: fileformat=dos |
4 |
| -# It is absolutely vital that this file has CRLF line endings. |
5 |
| -# |
6 |
| -# Note that we invert the test because we intent to let clangd exit prematurely. |
7 |
| -# |
8 |
| -# Test protocol parsing |
9 |
| -Content-Length: 125 |
10 |
| -Content-Type: application/vscode-jsonrpc; charset-utf-8 |
11 |
| - |
12 |
| -{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} |
13 |
| -# Test message with Content-Type after Content-Length |
14 |
| -# |
15 |
| -# CHECK: "jsonrpc": "2.0", |
16 |
| -# CHECK-NEXT: "result": { |
17 |
| -# CHECK: } |
18 |
| -Content-Length: 246 |
19 |
| - |
20 |
| -{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"struct fake { int a, bb, ccc; int f(int i, const float f) const; };\nint main() {\n fake f;\n f.\n}\n"}}} |
21 |
| - |
22 |
| -Content-Length: 104 |
23 |
| - |
24 |
| -{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"test:///main.cpp"}}} |
25 |
| - |
26 |
| -Content-Type: application/vscode-jsonrpc; charset-utf-8 |
27 |
| -Content-Length: 146 |
28 |
| - |
29 |
| -{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:/main.cpp"},"position":{"line":3,"character":5}}} |
30 |
| -# Test message with Content-Type before Content-Length |
31 |
| -# |
32 |
| -# CHECK: "id": 1, |
33 |
| -# CHECK-NEXT: "jsonrpc": "2.0", |
34 |
| -# CHECK-NEXT: "result": { |
35 |
| -# CHECK-NEXT: "isIncomplete": false, |
36 |
| -# CHECK-NEXT: "items": [ |
37 |
| -# CHECK: "filterText": "a", |
38 |
| -# CHECK-NEXT: "insertText": "a", |
39 |
| -# CHECK-NEXT: "insertTextFormat": 1, |
40 |
| -# CHECK-NEXT: "kind": 5, |
41 |
| -# CHECK-NEXT: "label": " a", |
42 |
| -# CHECK-NEXT: "score": {{[0-9]+.[0-9]+}}, |
43 |
| -# CHECK-NEXT: "sortText": "{{.*}}" |
44 |
| -# CHECK: ] |
45 |
| -# CHECK-NEXT: } |
46 |
| - |
47 |
| -X-Test: Testing |
48 |
| -Content-Type: application/vscode-jsonrpc; charset-utf-8 |
49 |
| -Content-Length: 146 |
50 |
| -Content-Type: application/vscode-jsonrpc; charset-utf-8 |
51 |
| -X-Testing: Test |
52 |
| - |
53 |
| -{"jsonrpc":"2.0","id":2,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:/main.cpp"},"position":{"line":3,"character":5}}} |
54 |
| - |
55 |
| -Content-Type: application/vscode-jsonrpc; charset-utf-8 |
56 |
| -Content-Length: 10 |
57 |
| -Content-Length: 146 |
58 |
| - |
59 |
| -{"jsonrpc":"2.0","id":3,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:/main.cpp"},"position":{"line":3,"character":5}}} |
60 |
| -# Test message with duplicate Content-Length headers |
61 |
| -# |
62 |
| -# CHECK: "id": 3, |
63 |
| -# CHECK-NEXT: "jsonrpc": "2.0", |
64 |
| -# CHECK-NEXT: "result": { |
65 |
| -# CHECK-NEXT: "isIncomplete": false, |
66 |
| -# CHECK-NEXT: "items": [ |
67 |
| -# CHECK: "filterText": "a", |
68 |
| -# CHECK-NEXT: "insertText": "a", |
69 |
| -# CHECK-NEXT: "insertTextFormat": 1, |
70 |
| -# CHECK-NEXT: "kind": 5, |
71 |
| -# CHECK-NEXT: "label": " a", |
72 |
| -# CHECK-NEXT: "score": {{[0-9]+.[0-9]+}}, |
73 |
| -# CHECK-NEXT: "sortText": "{{.*}}" |
74 |
| -# CHECK: ] |
75 |
| -# CHECK-NEXT: } |
76 |
| -# STDERR: Warning: Duplicate Content-Length header received. The previous value for this message (10) was ignored. |
77 |
| - |
78 |
| -Content-Type: application/vscode-jsonrpc; charset-utf-8 |
79 |
| -Content-Length: 10 |
80 |
| - |
81 |
| -{"jsonrpc":"2.0","id":4,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:/main.cpp"},"position":{"line":3,"character":5}}} |
82 |
| -# Test message with malformed Content-Length |
83 |
| -# |
84 |
| -# STDERR: JSON parse error |
85 |
| -# Ensure we recover by sending another (valid) message |
86 |
| - |
87 |
| -Content-Length: 146 |
88 |
| - |
89 |
| -{"jsonrpc":"2.0","id":5,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:/main.cpp"},"position":{"line":3,"character":5}}} |
90 |
| -# Test message with Content-Type before Content-Length |
91 |
| -# |
92 |
| -# CHECK: "id": 5, |
93 |
| -# CHECK-NEXT: "jsonrpc": "2.0", |
94 |
| -# CHECK-NEXT: "result": { |
95 |
| -# CHECK-NEXT: "isIncomplete": false, |
96 |
| -# CHECK-NEXT: "items": [ |
97 |
| -# CHECK: "filterText": "a", |
98 |
| -# CHECK-NEXT: "insertText": "a", |
99 |
| -# CHECK-NEXT: "insertTextFormat": 1, |
100 |
| -# CHECK-NEXT: "kind": 5, |
101 |
| -# CHECK-NEXT: "label": " a", |
102 |
| -# CHECK-NEXT: "score": {{[0-9]+.[0-9]+}}, |
103 |
| -# CHECK-NEXT: "sortText": "{{.*}}" |
104 |
| -# CHECK: ] |
105 |
| -# CHECK-NEXT: } |
106 |
| -Content-Length: 1024 |
107 |
| - |
108 |
| -{"jsonrpc":"2.0","id":5,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:/main.cpp"},"position":{"line":3,"character":5}}} |
109 |
| -# Test message which reads beyond the end of the stream. |
110 |
| -# |
111 |
| -# Ensure this is the last test in the file! |
112 |
| -# STDERR: Input was aborted. Read only {{[0-9]+}} bytes of expected {{[0-9]+}}. |
113 |
| - |
| 1 | +# RUN: not clangd -pretty -sync -enable-test-uri-scheme < %s | FileCheck -strict-whitespace %s |
| 2 | +# RUN: not clangd -pretty -sync -enable-test-uri-scheme < %s 2>&1 | FileCheck -check-prefix=STDERR %s |
| 3 | +# vim: fileformat=dos |
| 4 | +# It is absolutely vital that this file has CRLF line endings. |
| 5 | +# |
| 6 | +# Note that we invert the test because we intent to let clangd exit prematurely. |
| 7 | +# |
| 8 | +# Test protocol parsing |
| 9 | +Content-Length: 125 |
| 10 | +Content-Type: application/vscode-jsonrpc; charset-utf-8 |
| 11 | +
|
| 12 | +{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} |
| 13 | +# Test message with Content-Type after Content-Length |
| 14 | +# |
| 15 | +# CHECK: "jsonrpc": "2.0", |
| 16 | +# CHECK-NEXT: "result": { |
| 17 | +# CHECK: } |
| 18 | +Content-Length: 246 |
| 19 | +
|
| 20 | +{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"struct fake { int a, bb, ccc; int f(int i, const float f) const; };\nint main() {\n fake f;\n f.\n}\n"}}} |
| 21 | +
|
| 22 | +Content-Length: 104 |
| 23 | +
|
| 24 | +{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"test:///main.cpp"}}} |
| 25 | +
|
| 26 | +Content-Type: application/vscode-jsonrpc; charset-utf-8 |
| 27 | +Content-Length: 146 |
| 28 | +
|
| 29 | +{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:/main.cpp"},"position":{"line":3,"character":5}}} |
| 30 | +# Test message with Content-Type before Content-Length |
| 31 | +# |
| 32 | +# CHECK: "id": 1, |
| 33 | +# CHECK-NEXT: "jsonrpc": "2.0", |
| 34 | +# CHECK-NEXT: "result": { |
| 35 | +# CHECK-NEXT: "isIncomplete": false, |
| 36 | +# CHECK-NEXT: "items": [ |
| 37 | +# CHECK: "filterText": "a", |
| 38 | +# CHECK-NEXT: "insertText": "a", |
| 39 | +# CHECK-NEXT: "insertTextFormat": 1, |
| 40 | +# CHECK-NEXT: "kind": 5, |
| 41 | +# CHECK-NEXT: "label": " a", |
| 42 | +# CHECK-NEXT: "score": {{[0-9]+.[0-9]+}}, |
| 43 | +# CHECK-NEXT: "sortText": "{{.*}}" |
| 44 | +# CHECK: ] |
| 45 | +# CHECK-NEXT: } |
| 46 | +
|
| 47 | +X-Test: Testing |
| 48 | +Content-Type: application/vscode-jsonrpc; charset-utf-8 |
| 49 | +Content-Length: 146 |
| 50 | +Content-Type: application/vscode-jsonrpc; charset-utf-8 |
| 51 | +X-Testing: Test |
| 52 | +
|
| 53 | +{"jsonrpc":"2.0","id":2,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:/main.cpp"},"position":{"line":3,"character":5}}} |
| 54 | +
|
| 55 | +Content-Type: application/vscode-jsonrpc; charset-utf-8 |
| 56 | +Content-Length: 10 |
| 57 | +Content-Length: 146 |
| 58 | +
|
| 59 | +{"jsonrpc":"2.0","id":3,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:/main.cpp"},"position":{"line":3,"character":5}}} |
| 60 | +# Test message with duplicate Content-Length headers |
| 61 | +# |
| 62 | +# CHECK: "id": 3, |
| 63 | +# CHECK-NEXT: "jsonrpc": "2.0", |
| 64 | +# CHECK-NEXT: "result": { |
| 65 | +# CHECK-NEXT: "isIncomplete": false, |
| 66 | +# CHECK-NEXT: "items": [ |
| 67 | +# CHECK: "filterText": "a", |
| 68 | +# CHECK-NEXT: "insertText": "a", |
| 69 | +# CHECK-NEXT: "insertTextFormat": 1, |
| 70 | +# CHECK-NEXT: "kind": 5, |
| 71 | +# CHECK-NEXT: "label": " a", |
| 72 | +# CHECK-NEXT: "score": {{[0-9]+.[0-9]+}}, |
| 73 | +# CHECK-NEXT: "sortText": "{{.*}}" |
| 74 | +# CHECK: ] |
| 75 | +# CHECK-NEXT: } |
| 76 | +# STDERR: Warning: Duplicate Content-Length header received. The previous value for this message (10) was ignored. |
| 77 | +
|
| 78 | +Content-Type: application/vscode-jsonrpc; charset-utf-8 |
| 79 | +Content-Length: 10 |
| 80 | +
|
| 81 | +{"jsonrpc":"2.0","id":4,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:/main.cpp"},"position":{"line":3,"character":5}}} |
| 82 | +# Test message with malformed Content-Length |
| 83 | +# |
| 84 | +# STDERR: JSON parse error |
| 85 | +# Ensure we recover by sending another (valid) message |
| 86 | +
|
| 87 | +Content-Length: 146 |
| 88 | +
|
| 89 | +{"jsonrpc":"2.0","id":5,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:/main.cpp"},"position":{"line":3,"character":5}}} |
| 90 | +# Test message with Content-Type before Content-Length |
| 91 | +# |
| 92 | +# CHECK: "id": 5, |
| 93 | +# CHECK-NEXT: "jsonrpc": "2.0", |
| 94 | +# CHECK-NEXT: "result": { |
| 95 | +# CHECK-NEXT: "isIncomplete": false, |
| 96 | +# CHECK-NEXT: "items": [ |
| 97 | +# CHECK: "filterText": "a", |
| 98 | +# CHECK-NEXT: "insertText": "a", |
| 99 | +# CHECK-NEXT: "insertTextFormat": 1, |
| 100 | +# CHECK-NEXT: "kind": 5, |
| 101 | +# CHECK-NEXT: "label": " a", |
| 102 | +# CHECK-NEXT: "score": {{[0-9]+.[0-9]+}}, |
| 103 | +# CHECK-NEXT: "sortText": "{{.*}}" |
| 104 | +# CHECK: ] |
| 105 | +# CHECK-NEXT: } |
| 106 | +Content-Length: 1024 |
| 107 | +
|
| 108 | +{"jsonrpc":"2.0","id":5,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:/main.cpp"},"position":{"line":3,"character":5}}} |
| 109 | +# Test message which reads beyond the end of the stream. |
| 110 | +# |
| 111 | +# Ensure this is the last test in the file! |
| 112 | +# STDERR: Input was aborted. Read only {{[0-9]+}} bytes of expected {{[0-9]+}}. |
| 113 | +
|
0 commit comments