Skip to content

Conversation

morishin
Copy link

I will change sprintf to raise an error if single "%" character appears at the end.
ruby/ruby#1560 (comment)
https://bugs.ruby-lang.org/issues/13315

This pull-request follows the change.
Please review.

@eregon
Copy link
Member

eregon commented Mar 29, 2017

Thank you.
We will need confirmation from matz on https://bugs.ruby-lang.org/issues/13315 that raising an error is desired behavior.

("foo%" % []).should == "foo%"
it "raises an error if single % appears at the end" do
lambda { ("%" % []) }.should raise_error(ArgumentError)
lambda { ("foo%" % [])}.should raise_error(ArgumentError)
end
Copy link
Member

Choose a reason for hiding this comment

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

If the change is merged, it will only applies to trunk initially, and then maybe be backported.
Therefore, could you add a version guard like this

ruby_version_is ""..."2.5" do
  old spec
end
ruby_version_is "2.5" do
  new spec
end

?

Copy link
Author

Choose a reason for hiding this comment

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

Thank you @eregon !
I added a version guard. bdab6b2

@morishin
Copy link
Author

Matz said this behaviour is OK 👀 https://bugs.ruby-lang.org/issues/13315#note-4

@eregon
Copy link
Member

eregon commented May 25, 2017

Yeah! 🎉
I will merge your patch and the specs.

hsbt pushed a commit to ruby/ruby that referenced this pull request May 25, 2017
* Add tests and specs. See ruby/spec#401.
  Patch by Yuta Iwama and Shintaro Morikawa.
  [ruby-core:80153] [Bug #13315] [Fix GH-1560]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
@eregon
Copy link
Member

eregon commented May 25, 2017

Merged in ruby/ruby@fd8df3a

@eregon eregon closed this May 25, 2017
@morishin morishin deleted the follow-ruby-core-change branch May 26, 2017 13:26
eregon added a commit that referenced this pull request May 27, 2017
* Add tests and specs. See #401.
  Patch by Yuta Iwama and Shintaro Morikawa.
  [ruby-core:80153] [Bug 13315] [Fix ruby/ruby#1560]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
@morishin
Copy link
Author

Thank you @eregon !

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