Skip to content
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

Terminate :statement parsing at newlines #493

Merged
merged 2 commits into from
Aug 17, 2024
Merged

Terminate :statement parsing at newlines #493

merged 2 commits into from
Aug 17, 2024

Conversation

timholy
Copy link
Sponsor Member

@timholy timholy commented Aug 11, 2024

Addresses a portion of #316

test/hooks.jl Outdated
# Issue #81
f() = nothing
"""
@test JuliaSyntax.core_parser_hook(stmtstr, "somefile", 1, 0, :statement)[2] ∈ 19:21
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the range 19:21 for?

Copy link
Sponsor Member Author

@timholy timholy Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see that there's a truly unique "right" answer. So I was allowing anything that parses all the code but terminates before the comment starts.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh I see :)

If we're choosing a particular somewhat-arbitrary but well-defined behavior I'd prefer to be precise with the test so we can detect any unexpected changes.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I went with 19, which is the earliest this can terminate. I believe this probably matches the flisp parser, but not sure.

I wrote a "wide" test initially because of the annoyances I've experienced over time maintaining tests sensitive to what turn out to be irrelevant details (e.g., whether you add a space between elements when printing tuples). So I've sometimes started to ask, "what behavior do I most care about, and what's the widest test I can write that still enforces that behavior?" But I fully understand where you're coming from here, and it probably makes sense given that this is the origin of such choices rather than the receiver of such choices.

Copy link

codecov bot commented Aug 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.54%. Comparing base (6532515) to head (347f5b5).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #493      +/-   ##
==========================================
+ Coverage   96.21%   96.54%   +0.32%     
==========================================
  Files          13       13              
  Lines        4171     4193      +22     
==========================================
+ Hits         4013     4048      +35     
+ Misses        158      145      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@c42f c42f left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Tim! LGTM :-)

@timholy timholy merged commit 5c134f4 into main Aug 17, 2024
38 checks passed
@timholy timholy deleted the teh/stop_trivia branch August 17, 2024 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants