1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
mame 2008-06-02 16:22:47 +00:00
parent 41a1a4ed76
commit 10451cd8d4
2 changed files with 14 additions and 0 deletions

View file

@ -1,3 +1,7 @@
Tue Jun 3 01:21:51 2008 Yusuke Endoh <mame@tsg.ne.jp>
* test/ruby/test_method.rb: add a test.
Tue Jun 3 00:26:48 2008 Yusuke Endoh <mame@tsg.ne.jp>
* marshal.c (w_object): add a check for modification of array during

View file

@ -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