Skip to content

Commit 8e666ce

Browse files
authored
Add section descriptions in toolchain/check/testdata/interop/cpp/no_prelude/cpp_diagnostics.carbon as agreed in #5467 (#5497)
Part of #4666.
1 parent fbaae72 commit 8e666ce

File tree

1 file changed

+60
-16
lines changed

1 file changed

+60
-16
lines changed

toolchain/check/testdata/interop/cpp/no_prelude/cpp_diagnostics.carbon

Lines changed: 60 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
// TIP: To dump output, run:
99
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/no_prelude/cpp_diagnostics.carbon
1010

11+
// ============================================================================
12+
// One error
13+
// ============================================================================
14+
1115
// --- one_error.h
1216

1317
// CHECK:STDERR: ./one_error.h:[[@LINE+6]]: error: C++:
@@ -28,6 +32,10 @@ library "[[@TEST_NAME]]";
2832
// CHECK:STDERR:
2933
import Cpp library "one_error.h";
3034

35+
// ============================================================================
36+
// Multiple errors
37+
// ============================================================================
38+
3139
// --- multiple_errors.h
3240

3341
// CHECK:STDERR: ./multiple_errors.h:[[@LINE+6]]: error: C++:
@@ -59,6 +67,10 @@ library "[[@TEST_NAME]]";
5967
// CHECK:STDERR:
6068
import Cpp library "multiple_errors.h";
6169

70+
// ============================================================================
71+
// One warning
72+
// ============================================================================
73+
6274
// --- one_warning.h
6375

6476
// CHECK:STDERR: ./one_warning.h:[[@LINE+6]]: warning: C++:
@@ -79,6 +91,10 @@ library "[[@TEST_NAME]]";
7991
// CHECK:STDERR:
8092
import Cpp library "one_warning.h";
8193

94+
// ============================================================================
95+
// Multiple warnings
96+
// ============================================================================
97+
8298
// --- multiple_warnings.h
8399

84100
// CHECK:STDERR: ./multiple_warnings.h:[[@LINE+6]]: warning: C++:
@@ -121,6 +137,10 @@ library "[[@TEST_NAME]]";
121137
// CHECK:STDERR:
122138
import Cpp library "multiple_warnings.h";
123139

140+
// ============================================================================
141+
// One error and one warning
142+
// ============================================================================
143+
124144
// --- one_error_and_one_warning.h
125145

126146
// CHECK:STDERR: ./one_error_and_one_warning.h:[[@LINE+6]]: error: C++:
@@ -152,6 +172,10 @@ library "[[@TEST_NAME]]";
152172
// CHECK:STDERR:
153173
import Cpp library "one_error_and_one_warning.h";
154174

175+
// ============================================================================
176+
// Multiple errors and multiple warnings
177+
// ============================================================================
178+
155179
// --- multiple_errors_and_multiple_warnings.h
156180

157181
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:[[@LINE+6]]: error: C++:
@@ -222,6 +246,10 @@ library "[[@TEST_NAME]]";
222246
// CHECK:STDERR: [CppInteropParseWarning]
223247
import Cpp library "multiple_errors_and_multiple_warnings.h";
224248

249+
// ============================================================================
250+
// Multiple files with warnings
251+
// ============================================================================
252+
225253
// --- import_multiple_cpp_files_with_warnings.carbon
226254

227255
library "[[@TEST_NAME]]";
@@ -262,86 +290,94 @@ import Cpp library "one_warning.h";
262290
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
263291
// CHECK:STDERR:
264292
// CHECK:STDERR: ./one_error_and_one_warning.h:8: error: C++:
265-
// CHECK:STDERR: In file included from fail_import_multiple_cpp_files_with_warnings_and_errors.carbon.generated.cpp_imports.h:1:
293+
// CHECK:STDERR: In file included from fail_import_multiple_cpp_files_with_errors_and_warnings.carbon.generated.cpp_imports.h:1:
266294
// CHECK:STDERR: ./one_error_and_one_warning.h:8:2: error: "error1"
267295
// CHECK:STDERR: 8 | #error "error1"
268296
// CHECK:STDERR: | ^
269297
// CHECK:STDERR: [CppInteropParseError]
270298
import Cpp library "multiple_warnings.h";
271299

272-
// --- fail_import_multiple_cpp_files_with_warnings_and_errors.carbon
300+
// ============================================================================
301+
// Multiple files with errors and warnings
302+
// ============================================================================
303+
304+
// --- fail_import_multiple_cpp_files_with_errors_and_warnings.carbon
273305

274306
library "[[@TEST_NAME]]";
275307

276308
import Cpp library "one_error_and_one_warning.h";
277-
// CHECK:STDERR: fail_import_multiple_cpp_files_with_warnings_and_errors.carbon:[[@LINE+66]]:1: note: in `Cpp` import [InCppImport]
309+
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+66]]:1: note: in `Cpp` import [InCppImport]
278310
// CHECK:STDERR: import Cpp library "multiple_errors_and_multiple_warnings.h";
279311
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
280312
// CHECK:STDERR:
281313
// CHECK:STDERR: ./one_error_and_one_warning.h:9: warning: C++:
282-
// CHECK:STDERR: In file included from fail_import_multiple_cpp_files_with_warnings_and_errors.carbon.generated.cpp_imports.h:1:
314+
// CHECK:STDERR: In file included from fail_import_multiple_cpp_files_with_errors_and_warnings.carbon.generated.cpp_imports.h:1:
283315
// CHECK:STDERR: ./one_error_and_one_warning.h:9:2: warning: "warning1"
284316
// CHECK:STDERR: 9 | #warning "warning1"
285317
// CHECK:STDERR: | ^
286318
// CHECK:STDERR: [CppInteropParseWarning]
287-
// CHECK:STDERR: fail_import_multiple_cpp_files_with_warnings_and_errors.carbon:[[@LINE+56]]:1: note: in `Cpp` import [InCppImport]
319+
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+56]]:1: note: in `Cpp` import [InCppImport]
288320
// CHECK:STDERR: import Cpp library "multiple_errors_and_multiple_warnings.h";
289321
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
290322
// CHECK:STDERR:
291323
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:8: error: C++:
292-
// CHECK:STDERR: In file included from fail_import_multiple_cpp_files_with_warnings_and_errors.carbon.generated.cpp_imports.h:2:
324+
// CHECK:STDERR: In file included from fail_import_multiple_cpp_files_with_errors_and_warnings.carbon.generated.cpp_imports.h:2:
293325
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:8:2: error: "error1"
294326
// CHECK:STDERR: 8 | #error "error1"
295327
// CHECK:STDERR: | ^
296328
// CHECK:STDERR: [CppInteropParseError]
297-
// CHECK:STDERR: fail_import_multiple_cpp_files_with_warnings_and_errors.carbon:[[@LINE+46]]:1: note: in `Cpp` import [InCppImport]
329+
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+46]]:1: note: in `Cpp` import [InCppImport]
298330
// CHECK:STDERR: import Cpp library "multiple_errors_and_multiple_warnings.h";
299331
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
300332
// CHECK:STDERR:
301333
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:9: error: C++:
302-
// CHECK:STDERR: In file included from fail_import_multiple_cpp_files_with_warnings_and_errors.carbon.generated.cpp_imports.h:2:
334+
// CHECK:STDERR: In file included from fail_import_multiple_cpp_files_with_errors_and_warnings.carbon.generated.cpp_imports.h:2:
303335
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:9:2: error: "error2"
304336
// CHECK:STDERR: 9 | #error "error2"
305337
// CHECK:STDERR: | ^
306338
// CHECK:STDERR: [CppInteropParseError]
307-
// CHECK:STDERR: fail_import_multiple_cpp_files_with_warnings_and_errors.carbon:[[@LINE+36]]:1: note: in `Cpp` import [InCppImport]
339+
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+36]]:1: note: in `Cpp` import [InCppImport]
308340
// CHECK:STDERR: import Cpp library "multiple_errors_and_multiple_warnings.h";
309341
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
310342
// CHECK:STDERR:
311343
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:10: warning: C++:
312-
// CHECK:STDERR: In file included from fail_import_multiple_cpp_files_with_warnings_and_errors.carbon.generated.cpp_imports.h:2:
344+
// CHECK:STDERR: In file included from fail_import_multiple_cpp_files_with_errors_and_warnings.carbon.generated.cpp_imports.h:2:
313345
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:10:2: warning: "warning1"
314346
// CHECK:STDERR: 10 | #warning "warning1"
315347
// CHECK:STDERR: | ^
316348
// CHECK:STDERR: [CppInteropParseWarning]
317-
// CHECK:STDERR: fail_import_multiple_cpp_files_with_warnings_and_errors.carbon:[[@LINE+26]]:1: note: in `Cpp` import [InCppImport]
349+
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+26]]:1: note: in `Cpp` import [InCppImport]
318350
// CHECK:STDERR: import Cpp library "multiple_errors_and_multiple_warnings.h";
319351
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
320352
// CHECK:STDERR:
321353
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:11: warning: C++:
322-
// CHECK:STDERR: In file included from fail_import_multiple_cpp_files_with_warnings_and_errors.carbon.generated.cpp_imports.h:2:
354+
// CHECK:STDERR: In file included from fail_import_multiple_cpp_files_with_errors_and_warnings.carbon.generated.cpp_imports.h:2:
323355
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:11:2: warning: "warning2"
324356
// CHECK:STDERR: 11 | #warning "warning2"
325357
// CHECK:STDERR: | ^
326358
// CHECK:STDERR: [CppInteropParseWarning]
327-
// CHECK:STDERR: fail_import_multiple_cpp_files_with_warnings_and_errors.carbon:[[@LINE+16]]:1: note: in `Cpp` import [InCppImport]
359+
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+16]]:1: note: in `Cpp` import [InCppImport]
328360
// CHECK:STDERR: import Cpp library "multiple_errors_and_multiple_warnings.h";
329361
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
330362
// CHECK:STDERR:
331363
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:12: warning: C++:
332-
// CHECK:STDERR: In file included from fail_import_multiple_cpp_files_with_warnings_and_errors.carbon.generated.cpp_imports.h:2:
364+
// CHECK:STDERR: In file included from fail_import_multiple_cpp_files_with_errors_and_warnings.carbon.generated.cpp_imports.h:2:
333365
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:12:2: warning: "warning3"
334366
// CHECK:STDERR: 12 | #warning "warning3"
335367
// CHECK:STDERR: | ^
336368
// CHECK:STDERR: [CppInteropParseWarning]
337-
// CHECK:STDERR: fail_import_multiple_cpp_files_with_warnings_and_errors.carbon:[[@LINE+6]]:1: note: in `Cpp` import [InCppImport]
369+
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+6]]:1: note: in `Cpp` import [InCppImport]
338370
// CHECK:STDERR: import Cpp library "multiple_errors_and_multiple_warnings.h";
339371
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
340372
// CHECK:STDERR:
341373
// CHECK:STDERR: ./one_error.h:8: error: C++:
342374
// CHECK:STDERR: In file included from fail_import_indirect_error.carbon.generated.cpp_imports.h:1:
343375
import Cpp library "multiple_errors_and_multiple_warnings.h";
344376

377+
// ============================================================================
378+
// Indirect error
379+
// ============================================================================
380+
345381
// --- indirect_error.h
346382

347383
// CHECK:STDERR: In file included from ./indirect_error.h:[[@LINE+5]]:
@@ -363,6 +399,10 @@ library "[[@TEST_NAME]]";
363399
// CHECK:STDERR: In file included from import_indirect_warning.carbon.generated.cpp_imports.h:1:
364400
import Cpp library "indirect_error.h";
365401

402+
// ============================================================================
403+
// Indirect warning
404+
// ============================================================================
405+
366406
// --- indirect_warning.h
367407

368408
// CHECK:STDERR: In file included from ./indirect_warning.h:[[@LINE+5]]:
@@ -388,6 +428,10 @@ library "[[@TEST_NAME]]";
388428
// CHECK:STDERR: [CppInteropParseWarning]
389429
import Cpp library "indirect_warning.h";
390430

431+
// ============================================================================
432+
// Lexer error before import
433+
// ============================================================================
434+
391435
// --- fail_import_cpp_library_lexer_error.carbon
392436

393437
library "[[@TEST_NAME]]"; // Trailing comment
@@ -527,7 +571,7 @@ import Cpp library "one_warning.h";
527571
// CHECK:STDOUT: }
528572
// CHECK:STDOUT: }
529573
// CHECK:STDOUT:
530-
// CHECK:STDOUT: --- fail_import_multiple_cpp_files_with_warnings_and_errors.carbon
574+
// CHECK:STDOUT: --- fail_import_multiple_cpp_files_with_errors_and_warnings.carbon
531575
// CHECK:STDOUT:
532576
// CHECK:STDOUT: imports {
533577
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {

0 commit comments

Comments
 (0)