|
| 1 | +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM |
| 2 | +// Exceptions. See /LICENSE for license information. |
| 3 | +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 4 | +// |
| 5 | +// TODO: At present, this has a |
| 6 | +// "dropping diagnostic in /test.carbon.generated.cpp_imports.h". That should be |
| 7 | +// fixed to assign back to this file, but that may come from other fixes to C++ |
| 8 | +// diagnostic output. |
| 9 | +// |
| 10 | +// AUTOUPDATE |
| 11 | +// TIP: To test this file alone, run: |
| 12 | +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/language_server/testdata/text_document/open_with_cpp_nonexistent.carbon |
| 13 | +// TIP: To dump output, run: |
| 14 | +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/language_server/testdata/text_document/open_with_cpp_nonexistent.carbon |
| 15 | + |
| 16 | +// --- STDIN |
| 17 | +[[@LSP-CALL:initialize]] |
| 18 | +[[@LSP-NOTIFY:textDocument/didOpen: |
| 19 | + "textDocument": {"uri": "file:/test.carbon", "languageId": "carbon", |
| 20 | + "text": "import Cpp library \"nonexistent.h\";"} |
| 21 | +]] |
| 22 | +[[@LSP-NOTIFY:textDocument/didClose: |
| 23 | + "textDocument": {"uri": "file:/test.carbon"} |
| 24 | +]] |
| 25 | +[[@LSP-CALL:shutdown]] |
| 26 | +[[@LSP-NOTIFY:exit]] |
| 27 | + |
| 28 | +// --- AUTOUPDATE-SPLIT |
| 29 | + |
| 30 | +// CHECK:STDERR: /test.carbon: warning: dropping diagnostic in /test.carbon.generated.cpp_imports.h: |
| 31 | +// CHECK:STDERR: /test.carbon.generated.cpp_imports.h:1: error: C++: |
| 32 | +// CHECK:STDERR: /test.carbon.generated.cpp_imports.h:1:10: fatal error: 'nonexistent.h' file not found |
| 33 | +// CHECK:STDERR: 1 | #include "nonexistent.h" |
| 34 | +// CHECK:STDERR: | ^~~~~~~~~~~~~~~ |
| 35 | +// CHECK:STDERR: |
| 36 | +// CHECK:STDERR: /test.carbon:1:1: note: in `Cpp` import |
| 37 | +// CHECK:STDERR: import Cpp library "nonexistent.h"; |
| 38 | +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 39 | +// CHECK:STDERR: [LanguageServerDiagnosticInWrongFile] |
| 40 | +// CHECK:STDERR: |
| 41 | +// CHECK:STDOUT: Content-Length: 146{{\r}} |
| 42 | +// CHECK:STDOUT: {{\r}} |
| 43 | +// CHECK:STDOUT: { |
| 44 | +// CHECK:STDOUT: "id": 1, |
| 45 | +// CHECK:STDOUT: "jsonrpc": "2.0", |
| 46 | +// CHECK:STDOUT: "result": { |
| 47 | +// CHECK:STDOUT: "capabilities": { |
| 48 | +// CHECK:STDOUT: "documentSymbolProvider": true, |
| 49 | +// CHECK:STDOUT: "textDocumentSync": 2 |
| 50 | +// CHECK:STDOUT: } |
| 51 | +// CHECK:STDOUT: } |
| 52 | +// CHECK:STDOUT: }Content-Length: 144{{\r}} |
| 53 | +// CHECK:STDOUT: {{\r}} |
| 54 | +// CHECK:STDOUT: { |
| 55 | +// CHECK:STDOUT: "jsonrpc": "2.0", |
| 56 | +// CHECK:STDOUT: "method": "textDocument/publishDiagnostics", |
| 57 | +// CHECK:STDOUT: "params": { |
| 58 | +// CHECK:STDOUT: "diagnostics": [], |
| 59 | +// CHECK:STDOUT: "uri": "file:///test.carbon" |
| 60 | +// CHECK:STDOUT: } |
| 61 | +// CHECK:STDOUT: }Content-Length: 144{{\r}} |
| 62 | +// CHECK:STDOUT: {{\r}} |
| 63 | +// CHECK:STDOUT: { |
| 64 | +// CHECK:STDOUT: "jsonrpc": "2.0", |
| 65 | +// CHECK:STDOUT: "method": "textDocument/publishDiagnostics", |
| 66 | +// CHECK:STDOUT: "params": { |
| 67 | +// CHECK:STDOUT: "diagnostics": [], |
| 68 | +// CHECK:STDOUT: "uri": "file:///test.carbon" |
| 69 | +// CHECK:STDOUT: } |
| 70 | +// CHECK:STDOUT: }Content-Length: 51{{\r}} |
| 71 | +// CHECK:STDOUT: {{\r}} |
| 72 | +// CHECK:STDOUT: { |
| 73 | +// CHECK:STDOUT: "id": 2, |
| 74 | +// CHECK:STDOUT: "jsonrpc": "2.0", |
| 75 | +// CHECK:STDOUT: "result": null |
| 76 | +// CHECK:STDOUT: } |
0 commit comments