Skip to content

Inject test case enabled experimental features #2051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Tests/SwiftParserTest/Assertions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
) {
Expand Down Expand Up @@ -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<S: SyntaxProtocol>(
_ markedSource: String,
_ parse: (inout Parser) -> S,
Expand All @@ -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
Expand Down