Skip to content

Commit b0414b1

Browse files
committed
Inject test case enabled experimental features
This accidentally got dropped during the rebase, oops.
1 parent eeb89d7 commit b0414b1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Tests/SwiftParserTest/Assertions.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ extension ParserTestCase {
538538
applyFixIts: [String]? = nil,
539539
fixedSource expectedFixedSource: String? = nil,
540540
options: AssertParseOptions = [],
541-
experimentalFeatures: Parser.ExperimentalFeatures = [],
541+
experimentalFeatures: Parser.ExperimentalFeatures? = nil,
542542
file: StaticString = #file,
543543
line: UInt = #line
544544
) {
@@ -610,6 +610,8 @@ extension ParserTestCase {
610610
/// - applyFixIts: Applies only the fix-its with these messages.
611611
/// - fixedSource: Asserts that the source after applying fix-its matches
612612
/// this string.
613+
/// - experimentalFeatures: A list of experimental features to enable, or
614+
/// `nil` to enable the default set of features provided by the test case.
613615
func assertParse<S: SyntaxProtocol>(
614616
_ markedSource: String,
615617
_ parse: (inout Parser) -> S,
@@ -619,10 +621,12 @@ extension ParserTestCase {
619621
applyFixIts: [String]? = nil,
620622
fixedSource expectedFixedSource: String? = nil,
621623
options: AssertParseOptions = [],
622-
experimentalFeatures: Parser.ExperimentalFeatures = [],
624+
experimentalFeatures: Parser.ExperimentalFeatures? = nil,
623625
file: StaticString = #file,
624626
line: UInt = #line
625627
) {
628+
let experimentalFeatures = experimentalFeatures ?? self.experimentalFeatures
629+
626630
// Verify the parser can round-trip the source
627631
var (markerLocations, source) = extractMarkers(markedSource)
628632
markerLocations["START"] = 0

Tests/SwiftParserTest/ThenStatementTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,8 @@ final class ThenStatementTests: ParserTestCase {
806806
fixIts: ["insert statement"]
807807
),
808808
],
809-
fixedSource: "<#statement#>then 0"
809+
fixedSource: "<#statement#>then 0",
810+
experimentalFeatures: []
810811
)
811812
}
812813
}

0 commit comments

Comments
 (0)