File: execute-command.test

package info (click to toggle)
llvm-toolchain-6.0 1%3A6.0.1-10
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 598,080 kB
  • sloc: cpp: 3,046,253; ansic: 595,057; asm: 271,965; python: 128,926; objc: 106,554; sh: 21,906; lisp: 10,191; pascal: 6,094; ml: 5,544; perl: 5,265; makefile: 2,227; cs: 2,027; xml: 686; php: 212; csh: 117
file content (112 lines) | stat: -rw-r--r-- 5,619 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# RUN: clangd -pretty -run-synchronously < %s | FileCheck -strict-whitespace %s
# It is absolutely vital that this file has CRLF line endings.
#
Content-Length: 125

{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
#
Content-Length: 180

{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///foo.c","languageId":"c","version":1,"text":"int main(int i, char **a) { if (i = 2) {}}"}}}
#      CHECK:  "method": "textDocument/publishDiagnostics",
# CHECK-NEXT:  "params": {
# CHECK-NEXT:    "diagnostics": [
# CHECK-NEXT:      {
# CHECK-NEXT:        "message": "using the result of an assignment as a condition without parentheses",
# CHECK-NEXT:        "range": {
# CHECK-NEXT:          "end": {
# CHECK-NEXT:            "character": 37,
# CHECK-NEXT:            "line": 0
# CHECK-NEXT:          },
# CHECK-NEXT:          "start": {
# CHECK-NEXT:            "character": 32,
# CHECK-NEXT:            "line": 0
# CHECK-NEXT:          }
# CHECK-NEXT:        },
# CHECK-NEXT:        "severity": 2
# CHECK-NEXT:      },
# CHECK-NEXT:      {
# CHECK-NEXT:        "message": "place parentheses around the assignment to silence this warning",
# CHECK-NEXT:        "range": {
# CHECK-NEXT:          "end": {
# CHECK-NEXT:            "character": 35,
# CHECK-NEXT:            "line": 0
# CHECK-NEXT:          },
# CHECK-NEXT:          "start": {
# CHECK-NEXT:            "character": 34,
# CHECK-NEXT:            "line": 0
# CHECK-NEXT:          }
# CHECK-NEXT:        },
# CHECK-NEXT:        "severity": 3
# CHECK-NEXT:      },
# CHECK-NEXT:      {
# CHECK-NEXT:        "message": "use '==' to turn this assignment into an equality comparison",
# CHECK-NEXT:        "range": {
# CHECK-NEXT:          "end": {
# CHECK-NEXT:            "character": 35,
# CHECK-NEXT:            "line": 0
# CHECK-NEXT:          },
# CHECK-NEXT:          "start": {
# CHECK-NEXT:            "character": 34,
# CHECK-NEXT:            "line": 0
# CHECK-NEXT:          }
# CHECK-NEXT:        },
# CHECK-NEXT:        "severity": 3
# CHECK-NEXT:      }
# CHECK-NEXT:    ],
# CHECK-NEXT:    "uri": "file:///foo.c"
# CHECK-NEXT:  }
Content-Length: 72

{"jsonrpc":"2.0","id":3,"method":"workspace/executeCommand","params":{}}
# No command name
Content-Length: 85

{"jsonrpc":"2.0","id":4,"method":"workspace/executeCommand","params":{"command": {}}}
# Invalid, non-scalar command name
Content-Length: 345

{"jsonrpc":"2.0","id":5,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","custom":"foo", "arguments":[{"changes":{"file:///foo.c":[{"range":{"start":{"line":0,"character":32},"end":{"line":0,"character":32}},"newText":"("},{"range":{"start":{"line":0,"character":37},"end":{"line":0,"character":37}},"newText":")"}]}}]}}
Content-Length: 117

{"jsonrpc":"2.0","id":6,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":"foo"}}
# Arguments not a sequence.
Content-Length: 93

{"jsonrpc":"2.0","id":7,"method":"workspace/executeCommand","params":{"command":"mycommand"}}
# Unknown command.
Content-Length: 132

{"jsonrpc":"2.0","id":8,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","custom":"foo", "arguments":[""]}}
# ApplyFix argument not a mapping node.
Content-Length: 345

{"jsonrpc":"2.0","id":9,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"custom":"foo", "changes":{"file:///foo.c":[{"range":{"start":{"line":0,"character":32},"end":{"line":0,"character":32}},"newText":"("},{"range":{"start":{"line":0,"character":37},"end":{"line":0,"character":37}},"newText":")"}]}}]}}
# Custom field in WorkspaceEdit
Content-Length: 132

{"jsonrpc":"2.0","id":10,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":"foo"}]}}
# changes in WorkspaceEdit with no mapping node
Content-Length: 346

{"jsonrpc":"2.0","id":11,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":{"file:///foo.c":[{"range":{"start":{"line":0,"character":32},"end":{"line":0,"character":32}},"newText":"("},{"range":{"start":{"line":0,"character":37},"end":{"line":0,"character":37}},"newText":")"}], "custom":"foo"}}]}}
# Custom field in WorkspaceEditChange
Content-Length: 150

{"jsonrpc":"2.0","id":12,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":{"file:///foo.c":"bar"}}]}}
# No sequence node for TextEdits
Content-Length: 149

{"jsonrpc":"2.0","id":13,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":{"file:///foo.c":[""]}}]}}
# No mapping node for TextEdit
Content-Length: 265

{"jsonrpc":"2.0","id":14,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":{"file:///foo.c":[{"range":{"start":{"line":0,"character":32},"end":{"line":0,"character":32}},"newText":"("},{"range":"","newText":")"}]}}]}}
# TextEdit not decoded
Content-Length: 345

{"jsonrpc":"2.0","id":9,"method":"workspace/executeCommand","params":{"arguments":[{"custom":"foo", "changes":{"file:///foo.c":[{"range":{"start":{"line":0,"character":32},"end":{"line":0,"character":32}},"newText":"("},{"range":{"start":{"line":0,"character":37},"end":{"line":0,"character":37}},"newText":")"}]}}],"command":"clangd.applyFix"}}
# Command name after arguments
Content-Length: 44

{"jsonrpc":"2.0","id":3,"method":"shutdown"}