summaryrefslogtreecommitdiff
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
commit1d8ce92a37df9e8c1f9a68de82fee8c9b3e66af6 (patch)
tree418f10dffea9bb548ef3eeb2a6eb039f9112fc4b /bootstraptest/test_method.rb
parentd82f3e7d5cf98f484cd1b3ed397e45d2fd7cf806 (diff)
* 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: svn+ssh://ci.ruby-lang.org/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 faf3d4b..c95eec1 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)