Skip to content

Commit 71a0a56

Browse files
author
David Ungar
committed
Testing batch-mode diagnostic suppression.
1 parent c5b82b8 commit 71a0a56

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
typealias SomeType = NonExistentType
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// To avoid redundant diagnostics showing up in Xcode, batch-mode must suppress diagnostics in
2+
// non-primary files.
3+
//
4+
// RUN: rm -f %t.*
5+
6+
// RUN: not %target-swift-frontend -typecheck -primary-file %s -serialize-diagnostics-path %t.main.dia -primary-file %S/../Inputs/empty.swift -serialize-diagnostics-path %t.empty.dia %S/Inputs/serialized-diagnostics-batch-mode-suppression-helper.swift 2> %t.stderr.txt
7+
// RUN: c-index-test -read-diagnostics %t.main.dia 2> %t.main.txt
8+
// RUN: c-index-test -read-diagnostics %t.empty.dia 2> %t.empty.txt
9+
10+
// Ensure there was an error:
11+
12+
// RUN: %FileCheck -check-prefix=ERROR %s <%t.stderr.txt
13+
// ERROR: error:
14+
15+
// Ensure the error is not in the serialized diagnostics:
16+
17+
// RUN: %FileCheck -check-prefix=NO-DIAGNOSTICS %s <%t.main.txt
18+
// RUN: %FileCheck -check-prefix=NO-DIAGNOSTICS %s <%t.empty.txt
19+
// NO-DIAGNOSTICS: Number of diagnostics: 0
20+
21+
// RUN: not %FileCheck -check-prefix=ERROR %s <%t.main.txt
22+
// RUN: not %FileCheck -check-prefix=ERROR %s <%t.empty.txt
23+
24+
25+
func test(x: SomeType) {
26+
// CHECK-MAIN-DAG: serialized-diagnostics-batch-mode.swift:[[@LINE]]:3: error: use of unresolved identifier 'nonexistent'
27+
// CHECK-STDERR-DAG: serialized-diagnostics-batch-mode.swift:[[@LINE-1]]:3: error: use of unresolved identifier 'nonexistent'
28+
29+
// The other file has a similar call.
30+
// CHECK-HELPER-DAG: serialized-diagnostics-batch-mode-helper.swift:{{[0-9]+}}:3: error: use of unresolved identifier 'nonexistent'
31+
// CHECK-STDERR-DAG: serialized-diagnostics-batch-mode-helper.swift:{{[0-9]+}}:3: error: use of unresolved identifier 'nonexistent'
32+
}

0 commit comments

Comments
 (0)