summaryrefslogtreecommitdiffstats
path: root/bootstraptest/test_method.rb
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-03 18:58:42 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-03 18:58:42 +0000
commit303747b16b242c8caf08ca679a34fb199c316973 (patch)
tree418f10dffea9bb548ef3eeb2a6eb039f9112fc4b /bootstraptest/test_method.rb
parent7cc177e519fb4544832b3323555dde511b062bfc (diff)
downloadruby-303747b16b242c8caf08ca679a34fb199c316973.tar.gz
ruby-303747b16b242c8caf08ca679a34fb199c316973.tar.xz
ruby-303747b16b242c8caf08ca679a34fb199c316973.zip
* compile.c (iseq_compile_each): support v[&b]= type method call.
[ruby-dev:31094] * bootstraptest/test_method.rb: add a test for above. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bootstraptest/test_method.rb')
-rw-r--r--bootstraptest/test_method.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/bootstraptest/test_method.rb b/bootstraptest/test_method.rb
index faf3d4bc5..c95eec175 100644
--- a/bootstraptest/test_method.rb
+++ b/bootstraptest/test_method.rb
@@ -318,6 +318,25 @@ assert_equal '1', %q( class C; def m() 7 end; private :m end
assert_equal '1', %q( class C; def m() 1 end; private :m end
C.new.funcall(:m) )
+# with block
+assert_equal '[[:ok1, :foo], [:ok2, :foo, :bar]]',
+%q{
+ class C
+ def [](a)
+ $ary << [yield, a]
+ end
+ def []=(a, b)
+ $ary << [yield, a, b]
+ end
+ end
+
+ $ary = []
+ C.new[:foo, &lambda{:ok1}]
+ C.new[:foo, &lambda{:ok2}] = :bar
+ $ary
+}
+
+
# splat and block arguments
assert_equal %q{[[[:x, :y, :z], NilClass], [[1, :x, :y, :z], NilClass], [[1, 2, :x, :y, :z], NilClass], [[:obj], NilClass], [[1, :obj], NilClass], [[1, 2, :obj], NilClass], [[], Proc], [[1], Proc], [[1, 2], Proc], [[], Proc], [[1], Proc], [[1, 2], Proc], [[:x, :y, :z], Proc], [[1, :x, :y, :z], Proc], [[1, 2, :x, :y, :z], Proc]]}, %q{
def m(*args, &b)