Skip to content

Commit 8cd2f34

Browse files
committed
Generalize tests for both diagnostic styles, or force the LLVM style
These tests are using FileCheck to check the result of diagnostic formatting in ways that don't match the new formatter. Force the old formatter or, where possible, generalize so that they match both formatters.
1 parent 69ab4fc commit 8cd2f34

23 files changed

+56
-59
lines changed

test/Concurrency/toplevel/main.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ func nonIsolatedAsync() async {
2525
await nonIsolatedAsync()
2626

2727
// Swift6-CHECK: foo.swift{{.*}}main actor-isolated var 'a' can not be referenced from a non-isolated context
28-
// Swift6-CHECK: var declared here
29-
// Swift6-CHECK: foo.swift{{.*}}add '@MainActor' to make global function 'foo()' part of global actor 'MainActor'
28+
// Swift6-CHECK-DAG: var declared here
29+
// Swift6-CHECK-DAG: add '@MainActor' to make global function 'foo()' part of global actor 'MainActor'
3030

3131
// Swift5-CHECK-NOT: foo.swift{{.*}}main actor-isolated var 'a' can not be referenced from a non-isolated context
3232
// Swift5-CHECK-NOT: var declared here
33-
// Swift5-CHECK-NOT: foo.swift{{.*}}add '@MainActor' to make global function 'foo()' part of global actor 'MainActor'
33+
// Swift5-CHECK-NOT: add '@MainActor' to make global function 'foo()' part of global actor 'MainActor'
3434

3535
@MainActor
3636
func isolated() {

test/Driver/color-diagnostics.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// CHECK-CD: [0m1 = 2{{$}}
44

55
// RUN: not %target-swiftc_driver -no-color-diagnostics -emit-executable -o %t %s 2>&1 \
6-
// RUN: | %FileCheck -check-prefix=CHECK-NCD --match-full-lines %s
7-
// CHECK-NCD: 1 = 2
6+
// RUN: | %FileCheck -check-prefix=CHECK-NCD %s
7+
// CHECK-NCD: {{[ ]}}1 = 2
88

99
1 = 2

test/Frontend/invalid-testable-import.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44

55
@testable import single_int // CHECK: module 'single_int' was not compiled for testing
66

7-
x = 8 // CHECK-NOT: cannot find 'x' in scope
7+
x = 8
8+
9+
10+
11+
// CHECK-NOT: cannot find 'x' in scope

test/Interop/Cxx/class/fixit-add-safe-to-import-self-contained.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: rm -rf %t
22
// RUN: split-file %s %t
3-
// RUN: not %target-swift-frontend -typecheck -I %t/Inputs %t/test.swift -enable-experimental-cxx-interop 2>&1 | %FileCheck %s
3+
// RUN: not %target-swift-frontend -typecheck -I %t/Inputs %t/test.swift -enable-experimental-cxx-interop -diagnostic-style llvm 2>&1 | %FileCheck %s
44

55
//--- Inputs/module.modulemap
66
module Test {

test/Interop/Cxx/class/fixits-for-std-vector.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: rm -rf %t
22
// RUN: split-file %s %t
3-
// RUN: not %target-swift-frontend -typecheck -I %t/Inputs %t/test.swift -enable-experimental-cxx-interop 2>&1 | %FileCheck %s
3+
// RUN: not %target-swift-frontend -typecheck -I %t/Inputs %t/test.swift -enable-experimental-cxx-interop -diagnostic-style llvm 2>&1 | %FileCheck %s
44

55
// REQUIRES: OS=macosx || OS=linux-gnu
66

test/Interop/Cxx/class/invalid-class-errors.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: rm -rf %t
22
// RUN: split-file %s %t
3-
// RUN: not %target-swift-frontend -typecheck -I %t/Inputs %t/test.swift -enable-experimental-cxx-interop 2>&1 | %FileCheck %s
3+
// RUN: not %target-swift-frontend -typecheck -I %t/Inputs %t/test.swift -enable-experimental-cxx-interop -diagnostic-style llvm 2>&1 | %FileCheck %s
44

55
//--- Inputs/module.modulemap
66
module Test {

test/Interop/Cxx/class/invalid-unsafe-projection-errors.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: rm -rf %t
22
// RUN: split-file %s %t
3-
// RUN: not %target-swift-frontend -typecheck -I %t/Inputs %t/test.swift -enable-experimental-cxx-interop 2>&1 | %FileCheck %s
3+
// RUN: not %target-swift-frontend -typecheck -I %t/Inputs %t/test.swift -enable-experimental-cxx-interop -diagnostic-style llvm 2>&1 | %FileCheck %s
44

55
//--- Inputs/module.modulemap
66
module Test {

test/Parse/line-directive.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %target-typecheck-verify-swift
2-
// RUN: not %target-swift-frontend -c %s 2>&1 | %FileCheck %s
2+
// RUN: not %target-swift-frontend -c %s -diagnostic-style llvm 2>&1 | %FileCheck %s
33

44
let x = 0 // We need this because of the #sourceLocation-ends-with-a-newline requirement.
55

test/Sema/access-notes-invalid.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Extant {
1818
// GOOD-IGNORE-NOT: access-notes-invalid.swift:[[@LINE-1]]:{{[0-9]+}}: remark: implicitly added '@objc' to this instance method, as specified by access note for Access notes containing future, unknown syntax
1919
// GOOD-IGNORE-NOT: access-notes-invalid.swift:[[@LINE-2]]:{{[0-9]+}}: note: add '@objc' explicitly to silence this warning
2020
// GOOD-REMARK-DAG: access-notes-invalid.swift:[[@LINE-3]]:{{[0-9]+}}: remark: implicitly added '@objc' to this instance method, as specified by access note for Access notes containing future, unknown syntax
21-
// GOOD-REMARK-DAG: access-notes-invalid.swift:[[@LINE-4]]:{{[0-9]+}}: note: add '@objc' explicitly to silence this warning
21+
// GOOD-REMARK-DAG: note: add '@objc' explicitly to silence this warning
2222

2323
func bad(_: Int?) {} // expected-remark * {{}}
2424
// BAD-IGNORE-NOT: access-notes-invalid.swift:[[@LINE-1]]:{{[0-9]+}}: remark: ignored access note: method cannot be marked @objc by an access note because the type of the parameter cannot be represented in Objective-C; did not implicitly add '@objc' to this instance method, even though it was specified by access note for Access notes containing future, unknown syntax

test/Sema/availability_define_parsing.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: not %target-swift-frontend -typecheck %s \
1+
// RUN: not %target-swift-frontend -typecheck %s -diagnostic-style llvm \
22
// RUN: -define-availability "_brokenParse:a b c d" \
33
// RUN: -define-availability ":a b c d" \
44
// RUN: -define-availability "_justAName" \

0 commit comments

Comments
 (0)