mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@7f22a0b
This commit is contained in:
parent
e6d93a27af
commit
67a1e22589
62 changed files with 656 additions and 59 deletions
|
@ -40,4 +40,19 @@ describe "Integer#+" do
|
|||
-> { @bignum + :symbol}.should raise_error(TypeError)
|
||||
end
|
||||
end
|
||||
|
||||
it "can be redefined" do
|
||||
code = <<~RUBY
|
||||
class Integer
|
||||
alias_method :old_plus, :+
|
||||
def +(other)
|
||||
self - other
|
||||
end
|
||||
end
|
||||
result = 1 + 2
|
||||
Integer.alias_method :+, :old_plus
|
||||
print result
|
||||
RUBY
|
||||
ruby_exe(code).should == "-1"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue