summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-10 23:03:06 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-10 23:03:06 +0000
commit2abf664151aa8ea7769d2a6d0c7ebe82bddaba7c (patch)
treee1fa758c5bfddf7d70051a2158526e895fa36041 /sample
parenteccf9342c753ceeebe9187ac435ceae9ddad3402 (diff)
* eval.c (massign): remove unnecessary array unpacking; it should
be handled before massign() by svalue_to_mrhs(). * eval.c (svalue_to_mrhs): '*a = v' value conversion to avalue (i.e. [1] => [[1]], [1,2] => [1,2]). * eval.c (rb_eval): use svalue_to_mrhs. * eval.c (rb_yield_0): ditto. * eval.c (proc_invoke): break from "Proc#yield" is legal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample')
-rw-r--r--sample/test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/sample/test.rb b/sample/test.rb
index 141575b..247518c 100644
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -240,6 +240,17 @@ def r; return *[*[]]; end; a,b,*c = r(); test_ok([a,b,c] == [nil,nil,[]])
def r; return *[*[1]]; end; a,b,*c = r(); test_ok([a,b,c] == [1,nil,[]])
def r; return *[*[1,2]]; end; a,b,*c = r(); test_ok([a,b,c] == [1,2,[]])
+f = lambda {|r,| test_ok([] == r)}
+f.call([], *[])
+f.yield([], *[])
+
+f = lambda {|r,*l| test_ok([] == r); test_ok([1] == l)}
+f.call([], *[1])
+f.yield([], *[1])
+
+a,=*[1]
+test_ok(a == 1)
+
a = loop do break; end; test_ok(a == nil)
a = loop do break nil; end; test_ok(a == nil)
a = loop do break 1; end; test_ok(a == 1)