Skip to content

Commit

Permalink
Merge pull request #1069 from seven1m/fix-sprintf-c-spec
Browse files Browse the repository at this point in the history
Fix Kernel#sprintf %c to_int spec to test what it advertises
  • Loading branch information
andrykonchin authored Sep 2, 2023
2 parents c91ccef + 6d0a75e commit 091bc92
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/kernel/shared/sprintf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,13 @@ def obj.to_str

it "raises TypeError if converting to Integer with to_int returns non-Integer" do
obj = BasicObject.new
def obj.to_str
def obj.to_int
:foo
end

-> {
@method.call("%c", obj)
}.should raise_error(TypeError, /can't convert BasicObject to String/)
}.should raise_error(TypeError, /can't convert BasicObject to Integer/)
end
end

Expand Down

0 comments on commit 091bc92

Please sign in to comment.