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

Support Ruby 3.4's new error message format #237

Merged
merged 3 commits into from
Feb 15, 2024

Conversation

mame
Copy link
Contributor

@mame mame commented Feb 15, 2024

Ruby 3.4 will use a single quote instead of a backtrick as an open quote.

https://bugs.ruby-lang.org/issues/16495

Also, the backtrace line will have not only a method name but also its receiver class.

https://bugs.ruby-lang.org/issues/19117

Ruby 3.4 will use a single quote instead of a backtrick as an open
quote.

https://bugs.ruby-lang.org/issues/16495

Also, the backtrace line will have not only a method name but also its
receiver class.

https://bugs.ruby-lang.org/issues/19117
@@ -65,14 +65,14 @@ def internal_backtrace_entry?(entry)
entry.start_with?("<internal:")
end

def normalize_location(location)
def normalize_backtrace(location)
Copy link
Member

Choose a reason for hiding this comment

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

Could you keep normalize_location name?
The argument is a backtrace but we call it as (a fault's) "location" here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

filtered_location = location.reject do |entry|
jruby_backtrace_entry?(entry) or
rubinius_backtrace_entry?(entry) or
internal_backtrace_entry?(entry)
end
filtered_location.collect do |entry|
entry.sub(/:\d+:/, ":0:")
entry.sub(/:\d+:/, ":0:").sub(/in [`'](?:[^']+?[#.])?/, "in '")
Copy link
Member

Choose a reason for hiding this comment

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

Can we simplify this?

Suggested change
entry.sub(/:\d+:/, ":0:").sub(/in [`'](?:[^']+?[#.])?/, "in '")
entry.sub(/:\d+: in [`']/, ":0:in '")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did this one too. Still, (?:[^']+?[#.])? is needed to remove the receiver from the backtrace.

@kou kou merged commit 6be3324 into test-unit:master Feb 15, 2024
28 of 29 checks passed
@kou
Copy link
Member

kou commented Feb 15, 2024

Thanks!

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.

None yet

2 participants