summaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-02 16:22:47 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-02 16:22:47 +0000
commit9b279fa55e3466a44a2f42f6769d0117887e81c4 (patch)
treed4126b69124ce549d7ee8d7b08b070a5586689eb /test/ruby
parent0b03532dd60d067687557fb9b270061b048a2614 (diff)
downloadruby-9b279fa55e3466a44a2f42f6769d0117887e81c4.tar.gz
ruby-9b279fa55e3466a44a2f42f6769d0117887e81c4.tar.xz
ruby-9b279fa55e3466a44a2f42f6769d0117887e81c4.zip
* 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
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_method.rb10
1 files changed, 10 insertions, 0 deletions
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