From 2665e9923d9c16a56fe0a70438ba242927222d8b Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Thu, 10 Aug 2023 22:17:29 +0100 Subject: [PATCH] Inject test case enabled experimental features This accidentally got omitted when I split off the experimental feature work. --- Tests/SwiftParserTest/Assertions.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Tests/SwiftParserTest/Assertions.swift b/Tests/SwiftParserTest/Assertions.swift index e75ed7740fe..518bca0863a 100644 --- a/Tests/SwiftParserTest/Assertions.swift +++ b/Tests/SwiftParserTest/Assertions.swift @@ -538,7 +538,7 @@ extension ParserTestCase { applyFixIts: [String]? = nil, fixedSource expectedFixedSource: String? = nil, options: AssertParseOptions = [], - experimentalFeatures: Parser.ExperimentalFeatures = [], + experimentalFeatures: Parser.ExperimentalFeatures? = nil, file: StaticString = #file, line: UInt = #line ) { @@ -610,6 +610,8 @@ extension ParserTestCase { /// - applyFixIts: Applies only the fix-its with these messages. /// - fixedSource: Asserts that the source after applying fix-its matches /// this string. + /// - experimentalFeatures: A list of experimental features to enable, or + /// `nil` to enable the default set of features provided by the test case. func assertParse( _ markedSource: String, _ parse: (inout Parser) -> S, @@ -619,10 +621,12 @@ extension ParserTestCase { applyFixIts: [String]? = nil, fixedSource expectedFixedSource: String? = nil, options: AssertParseOptions = [], - experimentalFeatures: Parser.ExperimentalFeatures = [], + experimentalFeatures: Parser.ExperimentalFeatures? = nil, file: StaticString = #file, line: UInt = #line ) { + let experimentalFeatures = experimentalFeatures ?? self.experimentalFeatures + // Verify the parser can round-trip the source var (markerLocations, source) = extractMarkers(markedSource) markerLocations["START"] = 0