1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[Bug #18955] format single character for %c

This commit is contained in:
Nobuyoshi Nakada 2022-08-20 01:04:02 +09:00
parent ce384ef5a9
commit 1ef49de834
Notes: git 2022-08-20 03:57:47 +09:00
5 changed files with 38 additions and 18 deletions

View file

@ -368,8 +368,16 @@ describe "String#%" do
("%c" % 'A').should == "A"
end
it "raises an exception for multiple character strings as argument for %c" do
-> { "%c" % 'AA' }.should raise_error(ArgumentError)
ruby_version_is ""..."3.2" do
it "raises an exception for multiple character strings as argument for %c" do
-> { "%c" % 'AA' }.should raise_error(ArgumentError)
end
end
ruby_version_is "3.2" do
it "supports only the first character as argument for %c" do
("%c" % 'AA').should == "A"
end
end
it "calls to_str on argument for %c formats" do