From 92c16b2ce00be3c3b375aeb3036df49c93aefe1f Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Sat, 29 Mar 2025 18:18:31 -0700 Subject: [PATCH] Test updates for change to diagnostic group printing --- test/Frontend/features/adoption_mode.swift | 28 +++++++++---------- .../adoption_mode_adoptable_feature.swift | 8 +++--- unittests/AST/DiagnosticInfoTests.cpp | 8 ++++-- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/test/Frontend/features/adoption_mode.swift b/test/Frontend/features/adoption_mode.swift index b372ccd0d19..5cd437b1a6b 100644 --- a/test/Frontend/features/adoption_mode.swift +++ b/test/Frontend/features/adoption_mode.swift @@ -34,20 +34,20 @@ // CHECK-NOT: error: // CHECK-SWIFT-5-NOT: warning: -// CHECK-SWIFT-5: warning: '-disable-experimental-feature' argument 'DynamicActorIsolation:adoption' cannot specify a mode{{$}} -// CHECK-SWIFT-5-NEXT: warning: '-disable-experimental-feature' argument 'DynamicActorIsolation:invalid8' cannot specify a mode{{$}} -// CHECK-SWIFT-5-NEXT: warning: '-disable-experimental-feature' argument 'DynamicActorIsolation:invalid7' cannot specify a mode{{$}} -// CHECK-SWIFT-5-NEXT: warning: '-disable-upcoming-feature' argument 'DynamicActorIsolation:adoption' cannot specify a mode{{$}} -// CHECK-SWIFT-5-NEXT: warning: '-disable-upcoming-feature' argument 'DynamicActorIsolation:invalid6' cannot specify a mode{{$}} -// CHECK-SWIFT-5-NEXT: warning: '-disable-upcoming-feature' argument 'DynamicActorIsolation:invalid5' cannot specify a mode{{$}} -// CHECK-SWIFT-5-NEXT: warning: feature 'DynamicActorIsolation' does not support adoption mode{{$}} -// CHECK-SWIFT-5-NEXT: warning: feature 'DynamicActorIsolation' does not support adoption mode{{$}} -// CHECK-SWIFT-5-NEXT: warning: 'invalid4' is not a recognized mode for feature 'DynamicActorIsolation'{{$}} -// CHECK-SWIFT-5-NEXT: warning: 'invalid3' is not a recognized mode for feature 'DynamicActorIsolation'{{$}} -// CHECK-SWIFT-5-NEXT: warning: feature 'DynamicActorIsolation' does not support adoption mode{{$}} -// CHECK-SWIFT-5-NEXT: warning: feature 'DynamicActorIsolation' does not support adoption mode{{$}} -// CHECK-SWIFT-5-NEXT: warning: 'invalid2' is not a recognized mode for feature 'DynamicActorIsolation'{{$}} -// CHECK-SWIFT-5-NEXT: warning: 'invalid1' is not a recognized mode for feature 'DynamicActorIsolation'{{$}} +// CHECK-SWIFT-5: warning: '-disable-experimental-feature' argument 'DynamicActorIsolation:adoption' cannot specify a mode [#StrictLanguageFeatures]{{$}} +// CHECK-SWIFT-5-NEXT: warning: '-disable-experimental-feature' argument 'DynamicActorIsolation:invalid8' cannot specify a mode [#StrictLanguageFeatures]{{$}} +// CHECK-SWIFT-5-NEXT: warning: '-disable-experimental-feature' argument 'DynamicActorIsolation:invalid7' cannot specify a mode [#StrictLanguageFeatures]{{$}} +// CHECK-SWIFT-5-NEXT: warning: '-disable-upcoming-feature' argument 'DynamicActorIsolation:adoption' cannot specify a mode [#StrictLanguageFeatures]{{$}} +// CHECK-SWIFT-5-NEXT: warning: '-disable-upcoming-feature' argument 'DynamicActorIsolation:invalid6' cannot specify a mode [#StrictLanguageFeatures]{{$}} +// CHECK-SWIFT-5-NEXT: warning: '-disable-upcoming-feature' argument 'DynamicActorIsolation:invalid5' cannot specify a mode [#StrictLanguageFeatures]{{$}} +// CHECK-SWIFT-5-NEXT: warning: feature 'DynamicActorIsolation' does not support adoption mode [#StrictLanguageFeatures]{{$}} +// CHECK-SWIFT-5-NEXT: warning: feature 'DynamicActorIsolation' does not support adoption mode [#StrictLanguageFeatures]{{$}} +// CHECK-SWIFT-5-NEXT: warning: 'invalid4' is not a recognized mode for feature 'DynamicActorIsolation' [#StrictLanguageFeatures]{{$}} +// CHECK-SWIFT-5-NEXT: warning: 'invalid3' is not a recognized mode for feature 'DynamicActorIsolation' [#StrictLanguageFeatures]{{$}} +// CHECK-SWIFT-5-NEXT: warning: feature 'DynamicActorIsolation' does not support adoption mode [#StrictLanguageFeatures]{{$}} +// CHECK-SWIFT-5-NEXT: warning: feature 'DynamicActorIsolation' does not support adoption mode [#StrictLanguageFeatures]{{$}} +// CHECK-SWIFT-5-NEXT: warning: 'invalid2' is not a recognized mode for feature 'DynamicActorIsolation' [#StrictLanguageFeatures]{{$}} +// CHECK-SWIFT-5-NEXT: warning: 'invalid1' is not a recognized mode for feature 'DynamicActorIsolation' [#StrictLanguageFeatures]{{$}} // CHECK-SWIFT-5-NOT: warning: // CHECK-SWIFT-6-NOT: warning: diff --git a/test/Frontend/features/adoption_mode_adoptable_feature.swift b/test/Frontend/features/adoption_mode_adoptable_feature.swift index a1dbd95f035..213cf84df94 100644 --- a/test/Frontend/features/adoption_mode_adoptable_feature.swift +++ b/test/Frontend/features/adoption_mode_adoptable_feature.swift @@ -25,10 +25,10 @@ // CHECK-NOT: error: // CHECK-SWIFT-5-NOT: warning: -// CHECK-SWIFT-5: warning: '-disable-experimental-feature' argument 'ExistentialAny:adoption' cannot specify a mode{{$}} -// CHECK-SWIFT-5-NEXT: warning: '-disable-upcoming-feature' argument 'ExistentialAny:adoption' cannot specify a mode{{$}} -// CHECK-SWIFT-5-NEXT: warning: 'invalid2' is not a recognized mode for feature 'ExistentialAny'; did you mean 'adoption'?{{$}} -// CHECK-SWIFT-5-NEXT: warning: 'invalid1' is not a recognized mode for feature 'ExistentialAny'; did you mean 'adoption'?{{$}} +// CHECK-SWIFT-5: warning: '-disable-experimental-feature' argument 'ExistentialAny:adoption' cannot specify a mode [#StrictLanguageFeatures]{{$}} +// CHECK-SWIFT-5-NEXT: warning: '-disable-upcoming-feature' argument 'ExistentialAny:adoption' cannot specify a mode [#StrictLanguageFeatures]{{$}} +// CHECK-SWIFT-5-NEXT: warning: 'invalid2' is not a recognized mode for feature 'ExistentialAny'; did you mean 'adoption'? [#StrictLanguageFeatures]{{$}} +// CHECK-SWIFT-5-NEXT: warning: 'invalid1' is not a recognized mode for feature 'ExistentialAny'; did you mean 'adoption'? [#StrictLanguageFeatures]{{$}} // CHECK-SWIFT-5-NOT: warning: // CHECK-SWIFT-7-NOT: warning: diff --git a/unittests/AST/DiagnosticInfoTests.cpp b/unittests/AST/DiagnosticInfoTests.cpp index 22d409761a8..5c80fd3327d 100644 --- a/unittests/AST/DiagnosticInfoTests.cpp +++ b/unittests/AST/DiagnosticInfoTests.cpp @@ -131,7 +131,7 @@ TEST(DiagnosticInfo, PrintDiagnosticNamesMode_Group_NoGroup) { } TEST(DiagnosticInfo, PrintDiagnosticNamesMode_Group) { - // Test that we embed the correct group in the format string. + // Test that we include the correct group. testCase( [](DiagnosticEngine &diags) { diags.setPrintDiagnosticNamesMode(PrintDiagnosticNamesMode::Group); @@ -141,7 +141,8 @@ TEST(DiagnosticInfo, PrintDiagnosticNamesMode_Group) { diags.diagnose(SourceLoc(), diagnostic); }, [](DiagnosticEngine &, const DiagnosticInfo &info) { - EXPECT_TRUE(info.FormatString.ends_with(" [DeprecatedDeclaration]")); + EXPECT_FALSE(info.FormatString.ends_with(" [DeprecatedDeclaration]")); + EXPECT_TRUE(info.Category == "DeprecatedDeclaration"); }, /*expectedNumCallbackCalls=*/1); } @@ -160,7 +161,8 @@ TEST(DiagnosticInfo, PrintDiagnosticNamesMode_Group_WrappedDiag) { }, [](DiagnosticEngine &, const DiagnosticInfo &info) { EXPECT_EQ(info.ID, diag::error_in_a_future_swift_lang_mode.ID); - EXPECT_TRUE(info.FormatString.ends_with(" [DeprecatedDeclaration]")); + EXPECT_FALSE(info.FormatString.ends_with(" [DeprecatedDeclaration]")); + EXPECT_TRUE(info.Category == "DeprecatedDeclaration"); }, /*expectedNumCallbackCalls=*/1); }