@@ -75,6 +75,40 @@ public class WarningGroupControlTests: XCTestCase {
7575 )
7676 }
7777
78+ func testEnabledGroupIdentifiers( ) throws {
79+ let source =
80+ """
81+ @warn(Group1, as: warning)
82+ @warn(Group2, as: error)
83+ @warn(Group3, as: ignored)
84+ func foo() {
85+ @warn(Group4, as: warning)
86+ func bar() {
87+ @warn(Group5, as: ignored)
88+ @warn(Group6, as: ignored)
89+ func baz() {}
90+ @warn(Group7, as: error)
91+ func qux() {
92+ @warn(Group8, as: warning)
93+ func corge() {}
94+ }
95+ }
96+ }
97+ """
98+ var parser = Parser ( source)
99+ let parseTree = SourceFileSyntax . parse ( from: & parser)
100+ let warningControlTree = parseTree. warningGroupControlRegionTree ( )
101+ let enabledDiagnosticGroups = warningControlTree. enabledGroups
102+ XCTAssertTrue ( enabledDiagnosticGroups. contains ( " Group1 " ) )
103+ XCTAssertTrue ( enabledDiagnosticGroups. contains ( " Group2 " ) )
104+ XCTAssertFalse ( enabledDiagnosticGroups. contains ( " Group3 " ) )
105+ XCTAssertTrue ( enabledDiagnosticGroups. contains ( " Group4 " ) )
106+ XCTAssertFalse ( enabledDiagnosticGroups. contains ( " Group5 " ) )
107+ XCTAssertFalse ( enabledDiagnosticGroups. contains ( " Group6 " ) )
108+ XCTAssertTrue ( enabledDiagnosticGroups. contains ( " Group7 " ) )
109+ XCTAssertTrue ( enabledDiagnosticGroups. contains ( " Group8 " ) )
110+ }
111+
78112 func testNominalDeclWarningGroupControl( ) throws {
79113 try assertWarningGroupControl (
80114 """
0 commit comments