1 # REQUIRES: clangd-tidy-checks
2 # RUN: clangd -lit-test -clang-tidy-checks=bugprone-sizeof-expression < %s | FileCheck -strict-whitespace %s
3 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
5 {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///foo.c","languageId":"c","text":"int main() {\n(void)sizeof(42);\n}"}}}
6 # CHECK: "method": "textDocument/publishDiagnostics",
7 # CHECK-NEXT: "params": {
8 # CHECK-NEXT: "diagnostics": [
10 # CHECK-NEXT: "code": "bugprone-sizeof-expression",
11 # CHECK-NEXT: "codeDescription": {
12 # CHECK-NEXT: "href": "https://clang.llvm.org/extra/clang-tidy/checks/bugprone/sizeof-expression.html"
14 # CHECK-NEXT: "message": "Suspicious usage of 'sizeof(K)'; did you mean 'K'?",
15 # CHECK-NEXT: "range": {
16 # CHECK-NEXT: "end": {
17 # CHECK-NEXT: "character": 12,
18 # CHECK-NEXT: "line": 1
20 # CHECK-NEXT: "start": {
21 # CHECK-NEXT: "character": 6,
22 # CHECK-NEXT: "line": 1
25 # CHECK-NEXT: "severity": 2,
26 # CHECK-NEXT: "source": "clang-tidy"
29 # CHECK-NEXT: "uri": "file://{{.*}}/foo.c",
30 # CHECK-NEXT: "version": 0
33 {"jsonrpc":"2.0","id":2,"method":"sync","params":null}
35 {"jsonrpc":"2.0","method":"textDocument/didClose","params":{"textDocument":{"uri":"test:///foo.c"}}}
36 # CHECK: "method": "textDocument/publishDiagnostics",
37 # CHECK-NEXT: "params": {
38 # CHECK-NEXT: "diagnostics": [],
39 # CHECK-NEXT: "uri": "file://{{.*}}/foo.c"
42 {"jsonrpc":"2.0","id":5,"method":"shutdown"}
44 {"jsonrpc":"2.0","method":"exit"}