From 9b279fa55e3466a44a2f42f6769d0117887e81c4 Mon Sep 17 00:00:00 2001 From: mame Date: Mon, 2 Jun 2008 16:22:47 +0000 Subject: * test/ruby/test_method.rb: add a test. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_method.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index df0ec792f..e0267d777 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 -- cgit