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

Make "%u" an alias of "%d" on 1.9 #2265

Merged
merged 2 commits into from Apr 10, 2013

Conversation

leocassarani
Copy link
Member

Fix the last remaining failing RubySpec for String#% by turning the %u format into an alias of %d.

In the process of implementing this, I found out that in both 1.8 and 1.9 mode, certain format strings such as %024.30d (zero padding + fixed width + precision) were ignoring the precision specifier, producing strings that had fewer padding zeros than on MRI.

This was because the "fast, common case" branch in IntegerAtom was being executed even when the format string had a precision, even though the special optimised method that was later invoked only took the width into account. This was fixed by making sure the optimised branch isn't executed when a precision is given.

This pull request also contains a commit adding a RubySpec for the aforementioned behaviour of %d (and, consequently, %u under 1.9).

Also fix two other failing RubySpecs for Kernel#sprintf that were
affected by the change.
dbussink added a commit that referenced this pull request Apr 10, 2013
@dbussink dbussink merged commit 3378d5b into rubinius:master Apr 10, 2013
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