diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-02 16:22:47 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-02 16:22:47 +0000 |
commit | 10451cd8d466dbe18567c988a705ab8d497ee825 (patch) | |
tree | d4126b69124ce549d7ee8d7b08b070a5586689eb /test/ruby | |
parent | 41a1a4ed7633e02965dc1de593d16b7e1635c129 (diff) | |
download | ruby-10451cd8d466dbe18567c988a705ab8d497ee825.tar.gz |
* 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
Diffstat (limited to 'test/ruby')
-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 |