brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.2 KiB · b4bd48b Raw
70 lines · plain
1# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s2{"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:///foo.c","languageId":"c","text":"int main(int i, char **a) { if (i = 2) {}}"}}}5#      CHECK:  "method": "textDocument/publishDiagnostics",6# CHECK-NEXT:  "params": {7# CHECK-NEXT:    "diagnostics": [8# CHECK-NEXT:      {9# CHECK-NEXT:        "code": "-Wparentheses",10# CHECK-NEXT:        "message": "Using the result of an assignment as a condition without parentheses (fixes available)",11# CHECK-NEXT:        "range": {12# CHECK-NEXT:          "end": {13# CHECK-NEXT:            "character": 37,14# CHECK-NEXT:            "line": 015# CHECK-NEXT:          },16# CHECK-NEXT:          "start": {17# CHECK-NEXT:            "character": 32,18# CHECK-NEXT:            "line": 019# CHECK-NEXT:          }20# CHECK-NEXT:        },21# CHECK-NEXT:        "severity": 2,22# CHECK-NEXT:        "source": "clang"23# CHECK-NEXT:      }24# CHECK-NEXT:    ],25# CHECK-NEXT:    "uri": "file://{{.*}}/foo.c",26# CHECK-NEXT:    "version": 027# CHECK-NEXT:  }28---29# No command name30{"jsonrpc":"2.0","id":3,"method":"workspace/executeCommand","params":{}}31---32# Invalid, non-scalar command name33{"jsonrpc":"2.0","id":4,"method":"workspace/executeCommand","params":{"command": {}}}34---35{"jsonrpc":"2.0","id":5,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","custom":"foo", "arguments":[{"changes":{"test:///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":")"}]}}]}}36---37# Arguments not a sequence.38{"jsonrpc":"2.0","id":6,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":"foo"}}39---40# Unknown command.41{"jsonrpc":"2.0","id":7,"method":"workspace/executeCommand","params":{"command":"mycommand"}}42---43# ApplyFix argument not a mapping node.44{"jsonrpc":"2.0","id":8,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","custom":"foo", "arguments":[""]}}45---46# Custom field in WorkspaceEdit47{"jsonrpc":"2.0","id":9,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"custom":"foo", "changes":{"test:///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":")"}]}}]}}48---49# changes in WorkspaceEdit with no mapping node50{"jsonrpc":"2.0","id":10,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":"foo"}]}}51---52# Custom field in WorkspaceEditChange53{"jsonrpc":"2.0","id":11,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":{"test:///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"}}]}}54---55# No sequence node for TextEdits56{"jsonrpc":"2.0","id":12,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":{"test:///foo.c":"bar"}}]}}57---58# No mapping node for TextEdit59{"jsonrpc":"2.0","id":13,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":{"test:///foo.c":[""]}}]}}60---61# TextEdit not decoded62{"jsonrpc":"2.0","id":14,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":{"test:///foo.c":[{"range":{"start":{"line":0,"character":32},"end":{"line":0,"character":32}},"newText":"("},{"range":"","newText":")"}]}}]}}63---64# Command name after arguments65{"jsonrpc":"2.0","id":9,"method":"workspace/executeCommand","params":{"arguments":[{"custom":"foo", "changes":{"test:///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"}}66---67{"jsonrpc":"2.0","id":3,"method":"shutdown"}68---69{"jsonrpc":"2.0","method":"exit"}70