Skip to content

Support Ruby 3.4's new error message format#237

Merged
kou merged 3 commits intotest-unit:masterfrom
mame:no-backtick-in-error-messages
Feb 15, 2024
Merged

Support Ruby 3.4's new error message format#237
kou merged 3 commits intotest-unit:masterfrom
mame:no-backtick-in-error-messages

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

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!

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
@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.

2 participants