8
8
// TIP: To dump output, run:
9
9
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/no_prelude/cpp_diagnostics.carbon
10
10
11
+ // ============================================================================
12
+ // One error
13
+ // ============================================================================
14
+
11
15
// --- one_error.h
12
16
13
17
// CHECK:STDERR: ./one_error.h:[[@LINE+6]]: error: C++:
@@ -28,6 +32,10 @@ library "[[@TEST_NAME]]";
28
32
// CHECK:STDERR:
29
33
import Cpp library "one_error.h" ;
30
34
35
+ // ============================================================================
36
+ // Multiple errors
37
+ // ============================================================================
38
+
31
39
// --- multiple_errors.h
32
40
33
41
// CHECK:STDERR: ./multiple_errors.h:[[@LINE+6]]: error: C++:
@@ -59,6 +67,10 @@ library "[[@TEST_NAME]]";
59
67
// CHECK:STDERR:
60
68
import Cpp library "multiple_errors.h" ;
61
69
70
+ // ============================================================================
71
+ // One warning
72
+ // ============================================================================
73
+
62
74
// --- one_warning.h
63
75
64
76
// CHECK:STDERR: ./one_warning.h:[[@LINE+6]]: warning: C++:
@@ -79,6 +91,10 @@ library "[[@TEST_NAME]]";
79
91
// CHECK:STDERR:
80
92
import Cpp library "one_warning.h" ;
81
93
94
+ // ============================================================================
95
+ // Multiple warnings
96
+ // ============================================================================
97
+
82
98
// --- multiple_warnings.h
83
99
84
100
// CHECK:STDERR: ./multiple_warnings.h:[[@LINE+6]]: warning: C++:
@@ -121,6 +137,10 @@ library "[[@TEST_NAME]]";
121
137
// CHECK:STDERR:
122
138
import Cpp library "multiple_warnings.h" ;
123
139
140
+ // ============================================================================
141
+ // One error and one warning
142
+ // ============================================================================
143
+
124
144
// --- one_error_and_one_warning.h
125
145
126
146
// CHECK:STDERR: ./one_error_and_one_warning.h:[[@LINE+6]]: error: C++:
@@ -152,6 +172,10 @@ library "[[@TEST_NAME]]";
152
172
// CHECK:STDERR:
153
173
import Cpp library "one_error_and_one_warning.h" ;
154
174
175
+ // ============================================================================
176
+ // Multiple errors and multiple warnings
177
+ // ============================================================================
178
+
155
179
// --- multiple_errors_and_multiple_warnings.h
156
180
157
181
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:[[@LINE+6]]: error: C++:
@@ -222,6 +246,10 @@ library "[[@TEST_NAME]]";
222
246
// CHECK:STDERR: [CppInteropParseWarning]
223
247
import Cpp library "multiple_errors_and_multiple_warnings.h" ;
224
248
249
+ // ============================================================================
250
+ // Multiple files with warnings
251
+ // ============================================================================
252
+
225
253
// --- import_multiple_cpp_files_with_warnings.carbon
226
254
227
255
library "[[@TEST_NAME]]" ;
@@ -262,86 +290,94 @@ import Cpp library "one_warning.h";
262
290
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
263
291
// CHECK:STDERR:
264
292
// 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:
266
294
// CHECK:STDERR: ./one_error_and_one_warning.h:8:2: error: "error1"
267
295
// CHECK:STDERR: 8 | #error "error1"
268
296
// CHECK:STDERR: | ^
269
297
// CHECK:STDERR: [CppInteropParseError]
270
298
import Cpp library "multiple_warnings.h" ;
271
299
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
273
305
274
306
library "[[@TEST_NAME]]" ;
275
307
276
308
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]
278
310
// CHECK:STDERR: import Cpp library "multiple_errors_and_multiple_warnings.h";
279
311
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
280
312
// CHECK:STDERR:
281
313
// 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:
283
315
// CHECK:STDERR: ./one_error_and_one_warning.h:9:2: warning: "warning1"
284
316
// CHECK:STDERR: 9 | #warning "warning1"
285
317
// CHECK:STDERR: | ^
286
318
// 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]
288
320
// CHECK:STDERR: import Cpp library "multiple_errors_and_multiple_warnings.h";
289
321
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
290
322
// CHECK:STDERR:
291
323
// 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:
293
325
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:8:2: error: "error1"
294
326
// CHECK:STDERR: 8 | #error "error1"
295
327
// CHECK:STDERR: | ^
296
328
// 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]
298
330
// CHECK:STDERR: import Cpp library "multiple_errors_and_multiple_warnings.h";
299
331
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
300
332
// CHECK:STDERR:
301
333
// 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:
303
335
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:9:2: error: "error2"
304
336
// CHECK:STDERR: 9 | #error "error2"
305
337
// CHECK:STDERR: | ^
306
338
// 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]
308
340
// CHECK:STDERR: import Cpp library "multiple_errors_and_multiple_warnings.h";
309
341
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
310
342
// CHECK:STDERR:
311
343
// 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:
313
345
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:10:2: warning: "warning1"
314
346
// CHECK:STDERR: 10 | #warning "warning1"
315
347
// CHECK:STDERR: | ^
316
348
// 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]
318
350
// CHECK:STDERR: import Cpp library "multiple_errors_and_multiple_warnings.h";
319
351
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
320
352
// CHECK:STDERR:
321
353
// 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:
323
355
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:11:2: warning: "warning2"
324
356
// CHECK:STDERR: 11 | #warning "warning2"
325
357
// CHECK:STDERR: | ^
326
358
// 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]
328
360
// CHECK:STDERR: import Cpp library "multiple_errors_and_multiple_warnings.h";
329
361
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
330
362
// CHECK:STDERR:
331
363
// 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:
333
365
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:12:2: warning: "warning3"
334
366
// CHECK:STDERR: 12 | #warning "warning3"
335
367
// CHECK:STDERR: | ^
336
368
// 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]
338
370
// CHECK:STDERR: import Cpp library "multiple_errors_and_multiple_warnings.h";
339
371
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
340
372
// CHECK:STDERR:
341
373
// CHECK:STDERR: ./one_error.h:8: error: C++:
342
374
// CHECK:STDERR: In file included from fail_import_indirect_error.carbon.generated.cpp_imports.h:1:
343
375
import Cpp library "multiple_errors_and_multiple_warnings.h" ;
344
376
377
+ // ============================================================================
378
+ // Indirect error
379
+ // ============================================================================
380
+
345
381
// --- indirect_error.h
346
382
347
383
// CHECK:STDERR: In file included from ./indirect_error.h:[[@LINE+5]]:
@@ -363,6 +399,10 @@ library "[[@TEST_NAME]]";
363
399
// CHECK:STDERR: In file included from import_indirect_warning.carbon.generated.cpp_imports.h:1:
364
400
import Cpp library "indirect_error.h" ;
365
401
402
+ // ============================================================================
403
+ // Indirect warning
404
+ // ============================================================================
405
+
366
406
// --- indirect_warning.h
367
407
368
408
// CHECK:STDERR: In file included from ./indirect_warning.h:[[@LINE+5]]:
@@ -388,6 +428,10 @@ library "[[@TEST_NAME]]";
388
428
// CHECK:STDERR: [CppInteropParseWarning]
389
429
import Cpp library "indirect_warning.h" ;
390
430
431
+ // ============================================================================
432
+ // Lexer error before import
433
+ // ============================================================================
434
+
391
435
// --- fail_import_cpp_library_lexer_error.carbon
392
436
393
437
library "[[@TEST_NAME]]" ; // Trailing comment
@@ -527,7 +571,7 @@ import Cpp library "one_warning.h";
527
571
// CHECK:STDOUT: }
528
572
// CHECK:STDOUT: }
529
573
// 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
531
575
// CHECK:STDOUT:
532
576
// CHECK:STDOUT: imports {
533
577
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
0 commit comments