Skip to content

Commit 797476f

Browse files
authored
Merge pull request #86054 from compnerd/checks
test: adjust test for more string matching flexibility
2 parents d8855c8 + c7e0d78 commit 797476f

File tree

1 file changed

+31
-6
lines changed

1 file changed

+31
-6
lines changed

test/CAS/cached_diagnostics_macro.swift

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
// RUN: split-file %s %t
55
// RUN: %host-build-swift -swift-version 5 -emit-library -o %t/%target-library-name(MacroDefinition) -module-name=MacroDefinition %t/macro.swift
66

7-
// RUN: %target-swift-frontend -typecheck -module-load-mode prefer-serialized -module-name MyApp -module-cache-path %t/clang-module-cache -O \
8-
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
9-
// RUN: %t/main.swift -swift-version 5 -external-plugin-path %t#%swift-plugin-server 2> %t/diag1.txt
10-
117
// RUN: %target-swift-frontend -scan-dependencies -module-load-mode prefer-serialized -module-name MyApp -module-cache-path %t/clang-module-cache -O \
128
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
139
// RUN: %t/main.swift -o %t/deps.json -swift-version 5 -cache-compile-job -cas-path %t/cas -external-plugin-path %t#%swift-plugin-server
@@ -24,9 +20,38 @@
2420
// RUN: -swift-version 5 -module-name MyApp -O \
2521
// RUN: -external-plugin-path %t#%swift-plugin-server \
2622
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
27-
// RUN: %t/main.swift @%t/MyApp.cmd -serialize-diagnostics-path %t/Test.diag 2> %t/diag2.txt
23+
// RUN: %t/main.swift @%t/MyApp.cmd -serialize-diagnostics-path %t/Test.diag 2>&1 | %FileCheck -check-prefix CHECK-DIAG %s
24+
25+
// CHECK-DIAG: macro expansion #myWarning:1:1: warning: 'testDeprecated()' is deprecated [#DeprecatedDeclaration]
26+
// CHECK-DIAG-NEXT: `- TMP_DIR{{/|\\}}main.swift:8:36: note: expanded code originates here
27+
// CHECK-DIAG-NEXT: 6 |
28+
// CHECK-DIAG-NEXT: 7 | func testDiscardableStringify(x: Int) {
29+
// CHECK-DIAG-NEXT: 8 | #toMyWarning("this is a warning")
30+
// CHECK-DIAG-NEXT: | `- note: in expansion of macro 'toMyWarning' here
31+
// CHECK-DIAG-NEXT: +--- macro expansion #toMyWarning -----------------------------------
32+
// CHECK-DIAG-NEXT: |1 | #myWarning("")
33+
// CHECK-DIAG-NEXT: | | `- note: in expansion of macro 'myWarning' here
34+
// CHECK-DIAG-NEXT: | +--- macro expansion #myWarning ----------------------------------
35+
// CHECK-DIAG-NEXT: | |1 | testDeprecated()
36+
// CHECK-DIAG-NEXT: | | | `- warning: 'testDeprecated()' is deprecated [#DeprecatedDeclaration]
37+
// CHECK-DIAG-NEXT: | +-----------------------------------------------------------------
38+
// CHECK-DIAG-NEXT: +--------------------------------------------------------------------
39+
// CHECK-DIAG-NEXT: 9 | #myWarning("this is a warning")
40+
// CHECK-DIAG-NEXT: 10 | }
2841

29-
// RUN: diff %t/diag1.txt %t/diag2.txt
42+
// CHECK-DIAG: macro expansion #myWarning:1:1: warning: 'testDeprecated()' is deprecated [#DeprecatedDeclaration]
43+
// CHECK-DIAG-NEXT: `- TMP_DIR{{/|\\}}main.swift:9:34: note: expanded code originates here
44+
// CHECK-DIAG-NEXT: 7 | func testDiscardableStringify(x: Int) {
45+
// CHECK-DIAG-NEXT: 8 | #toMyWarning("this is a warning")
46+
// CHECK-DIAG-NEXT: 9 | #myWarning("this is a warning")
47+
// CHECK-DIAG-NEXT: | `- note: in expansion of macro 'myWarning' here
48+
// CHECK-DIAG-NEXT: +--- macro expansion #myWarning -------------------------------------
49+
// CHECK-DIAG-NEXT: |1 | testDeprecated()
50+
// CHECK-DIAG-NEXT: | | `- warning: 'testDeprecated()' is deprecated [#DeprecatedDeclaration]
51+
// CHECK-DIAG-NEXT: +--------------------------------------------------------------------
52+
// CHECK-DIAG-NEXT: 10 | }
53+
// CHECK-DIAG-NEXT: 11 |
54+
// CHECK-DIAG: [#DeprecatedDeclaration]: <https://docs.swift.org/compiler/documentation/diagnostics/deprecated-declaration>
3055

3156
//--- macro.swift
3257
import SwiftDiagnostics

0 commit comments

Comments
 (0)