-
Notifications
You must be signed in to change notification settings - Fork 439
Add utils for incremental parse test #1712
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
Add utils for incremental parse test #1712
Conversation
7cc635a
to
c62a189
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I think we are going in the right direction by having a single assert
function that performs all these checks because that did turn out super valuable for assertParse
. I’ve got a few design comments inline.
Sources/_SwiftSyntaxTestSupport/IncrementalParseTestUtils.swift
Outdated
Show resolved
Hide resolved
Sources/_SwiftSyntaxTestSupport/IncrementalParseTestUtils.swift
Outdated
Show resolved
Hide resolved
Sources/_SwiftSyntaxTestSupport/IncrementalParseTestUtils.swift
Outdated
Show resolved
Hide resolved
Sources/_SwiftSyntaxTestSupport/IncrementalParseTestUtils.swift
Outdated
Show resolved
Hide resolved
Sources/_SwiftSyntaxTestSupport/IncrementalParseTestUtils.swift
Outdated
Show resolved
Hide resolved
Sources/_SwiftSyntaxTestSupport/IncrementalParseTestUtils.swift
Outdated
Show resolved
Hide resolved
Tests/SwiftSyntaxTestSupportTest/IncrementalParseTestUtilsTest.swift
Outdated
Show resolved
Hide resolved
What do you think about cherry-picking this commit to the functionality pr (#1685) and just close this one? Since we could just test this util with the incremental parse test case. (I don't know how |
692ab16
to
d74d81e
Compare
Sources/_SwiftSyntaxTestSupport/IncrementalParseTestUtils.swift
Outdated
Show resolved
Hide resolved
Sources/_SwiftSyntaxTestSupport/IncrementalParseTestUtils.swift
Outdated
Show resolved
Hide resolved
Sources/_SwiftSyntaxTestSupport/IncrementalParseTestUtils.swift
Outdated
Show resolved
Hide resolved
Sources/_SwiftSyntaxTestSupport/IncrementalParseTestUtils.swift
Outdated
Show resolved
Hide resolved
Sources/_SwiftSyntaxTestSupport/IncrementalParseTestUtils.swift
Outdated
Show resolved
Hide resolved
Sources/_SwiftSyntaxTestSupport/IncrementalParseTestUtils.swift
Outdated
Show resolved
Hide resolved
Sources/_SwiftSyntaxTestSupport/IncrementalParseTestUtils.swift
Outdated
Show resolved
Hide resolved
Sources/_SwiftSyntaxTestSupport/IncrementalParseTestUtils.swift
Outdated
Show resolved
Hide resolved
Sources/_SwiftSyntaxTestSupport/IncrementalParseTestUtils.swift
Outdated
Show resolved
Hide resolved
assertIncrementalParse( | ||
""" | ||
struct A⏩️⏸️A⏪️ { func f() { | ||
""" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These look so nice and short now 🤩
I think keeping this as a standalone PR makes sense. It provides value on its own and will allow us to keep the PR that actually implements incremental parsing focussed. Also: I think we’ve got this PR really close to being merged. |
d74d81e
to
7548b83
Compare
Great! let's just keep this. |
Sources/_SwiftSyntaxTestSupport/IncrementalParseTestUtils.swift
Outdated
Show resolved
Hide resolved
Sources/_SwiftSyntaxTestSupport/IncrementalParseTestUtils.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. I’ve got a few minor comments left, otherwise LGTM.
Sources/_SwiftSyntaxTestSupport/IncrementalParseTestUtils.swift
Outdated
Show resolved
Hide resolved
line: line | ||
) | ||
|
||
for targetNode in expectedReusedNodes { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These aren’t really nodes, right? Nitpick: targetNode
is a little ambiguous. What do you think about expectedReusedNode
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, these aren't actually nodes. I just can't come up with a more proper name for them😂. Do you have any idea about the name? I've renamed targetNode
to expectedReusedNode
.
Also, I think you might to need to rebase on top of main and run swift-format to pick up #1714. |
7548b83
to
09bb68a
Compare
I've rebased this pr and re-run |
@swift-ci please test |
@swift-ci please test windows |
Looks like try XCTSkipIf(true, "Swift parser does not handle node reuse yet") |
09bb68a
to
259542b
Compare
Ah, I see. Already fixed this. |
@swift-ci Please test |
This change should allow us to verify the correctness of incremental parse with a single function, containing round-trip, substructure, and reused nodes validation like
assertParse
.