From 10451cd8d466dbe18567c988a705ab8d497ee825 Mon Sep 17 00:00:00 2001 From: mame Date: Mon, 2 Jun 2008 16:22:47 +0000 Subject: [PATCH] * test/ruby/test_method.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ test/ruby/test_method.rb | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/ChangeLog b/ChangeLog index bafbfaa9f9..e26449540a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Jun 3 01:21:51 2008 Yusuke Endoh + + * test/ruby/test_method.rb: add a test. + Tue Jun 3 00:26:48 2008 Yusuke Endoh * marshal.c (w_object): add a check for modification of array during 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