diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_assignment.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_assignment.rb b/test/ruby/test_assignment.rb index 604464bbd3..c6f1cd1bc7 100644 --- a/test/ruby/test_assignment.rb +++ b/test/ruby/test_assignment.rb @@ -102,8 +102,12 @@ class TestAssignment < Test::Unit::TestCase end def test_assign_private_self + bug9907 = '[ruby-core:62949] [Bug #9907]' + o = Object.new class << o + def foo; 42; end + def [](i); 42; end private def foo=(a); 42; end def []=(i, a); 42; end @@ -122,6 +126,20 @@ class TestAssignment < Test::Unit::TestCase assert_nothing_raised(NoMethodError) { assert_equal(1, o.instance_eval {self[0] = 1}) } + + assert_nothing_raised(NoMethodError, bug9907) { + assert_equal(43, o.instance_eval {self.foo += 1}) + } + assert_nothing_raised(NoMethodError, bug9907) { + assert_equal(1, o.instance_eval {self.foo &&= 1}) + } + + assert_nothing_raised(NoMethodError, bug9907) { + assert_equal(43, o.instance_eval {self[0] += 1}) + } + assert_nothing_raised(NoMethodError, bug9907) { + assert_equal(1, o.instance_eval {self[0] &&= 1}) + } end def test_yield |