diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_method.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index df0ec792f3..e0267d777f 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -220,4 +220,14 @@ class TestMethod < Test::Unit::TestCase def test_caller_negative_level assert_raise(ArgumentError) { caller(-1) } end + + def test_attrset_ivar + c = Class.new + c.class_eval { attr_accessor :foo } + o = c.new + o.method(:foo=).call(42) + assert_equal(42, o.foo) + assert_raise(ArgumentError) { o.method(:foo=).call(1, 2, 3) } + assert_raise(ArgumentError) { o.method(:foo).call(1) } + end end |