diff options
Diffstat (limited to 'test/ruby/test_case.rb')
-rw-r--r-- | test/ruby/test_case.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_case.rb b/test/ruby/test_case.rb index f20d1dfd7e..b9f8ab264d 100644 --- a/test/ruby/test_case.rb +++ b/test/ruby/test_case.rb @@ -121,4 +121,25 @@ class TestCase < Test::Unit::TestCase end } end + + module NilEqq + refine NilClass do + def === other + false + end + end + end + + class NilEqqClass + using NilEqq + + def eqq(a) + case a; when nil then nil; else :not_nil; end + end + end + + + def test_deoptimize_nil + assert_equal :not_nil, NilEqqClass.new.eqq(nil) + end end |