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

Enable String#to_i spec #2224

Merged
merged 12 commits into from
Oct 30, 2022
Merged

Enable String#to_i spec #2224

merged 12 commits into from
Oct 30, 2022

Conversation

xulaus
Copy link
Contributor

@xulaus xulaus commented Oct 29, 2022

Relates to #1912

Currently String#to_i isn't in the enforced specs, and there deviations from MRI because of this.
This PR makes to_i spec compliant, asides from the cases where a Bignum is needed which now throw a NotImplemented error instead.

While doing this work I did attempt to use the scolapasta-int-parse implementation, however as to_i parses as much as possible before failure and scolapasta either passes or returns an error I would have had to make more changes that I felt comfortable with in that library to make the specs pass. This has lead to a duplication of logic, but there is already an issue to fix this (#2075)

Copy link
Member

@lopopolo lopopolo left a comment

Choose a reason for hiding this comment

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

This is looking good so far and I'm excited to turn the specs on. I think there are some spots where this code still drifts from MRI.

For the cases that are not covered by the specs, can you add some integrations tests to:

def spec
string_match_operator
string_element_reference_regexp
string_byteslice
string_scan
string_unary_minus
string_reverse
string_tr
string_end_with
true
end

artichoke-backend/src/extn/core/string/trampoline.rs Outdated Show resolved Hide resolved
artichoke-backend/src/extn/core/string/trampoline.rs Outdated Show resolved Hide resolved
artichoke-backend/src/extn/core/string/trampoline.rs Outdated Show resolved Hide resolved
Copy link
Member

@lopopolo lopopolo left a comment

Choose a reason for hiding this comment

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

this looks great! thank you for the logic fixes, the new specs, and the new integration tests

@lopopolo lopopolo merged commit 7d9ee15 into artichoke:trunk Oct 30, 2022
@xulaus xulaus deleted the enable_string_to_i_spec branch October 31, 2022 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants