diff options
Diffstat (limited to 'test/-ext-/integer')
-rw-r--r-- | test/-ext-/integer/test_my_integer.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/-ext-/integer/test_my_integer.rb b/test/-ext-/integer/test_my_integer.rb index bc4757f463..e6d8dd1a07 100644 --- a/test/-ext-/integer/test_my_integer.rb +++ b/test/-ext-/integer/test_my_integer.rb @@ -23,4 +23,26 @@ class TestIntegerExt < Test::Unit::TestCase end end end + + def test_my_integer_cmp + assert_raise(NotImplementedError) do + Bug::Integer::MyInteger.new <=> 0 + end + + begin + Bug::Integer::MyInteger.class_eval do + def <=>(other) + 0 + end + end + + assert_nothing_raised do + Bug::Integer::MyInteger.new <=> 0 + end + ensure + Bug::Integer::MyInteger.class_eval do + remove_method :<=> + end + end + end end |