summaryrefslogtreecommitdiff
path: root/sample/test.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-06-23 15:14:28 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-06-23 15:14:28 +0000
commit0869399cbf26c16c3226f338661da87882418ff8 (patch)
tree68824a34a64308058eac860155bb53140d5f09bb /sample/test.rb
parentc0648ecc85c307388895bc420b2eb61ab46966b2 (diff)
* eval.c (svalue_to_avalue): new conversion scheme between single
value and array values. * eval.c (avalue_to_svalue): ditto. * eval.c (rb_eval): REXPAND now uses avalue_to_svalue(), return and yield too. * eval.c (rb_yield_0): use avalue_to_svalue(). * eval.c (proc_invoke): Proc#call gives avaules, whereas Proc#yield gives mvalues. * eval.c (bmcall): convert given value (svalue) to avalue. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/test.rb')
-rw-r--r--sample/test.rb64
1 files changed, 32 insertions, 32 deletions
diff --git a/sample/test.rb b/sample/test.rb
index f8edd3a..6c352fa 100644
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -64,12 +64,12 @@ a = *[*[1,2]]; test_ok(a == [1,2])
*a = nil; test_ok(a == [])
*a = 1; test_ok(a == [1])
-*a = []; test_ok(a == [[]])
-*a = [1]; test_ok(a == [[1]])
-*a = [nil]; test_ok(a == [[nil]])
-*a = [[]]; test_ok(a == [[[]]])
-*a = [*[]]; test_ok(a == [[]])
-*a = [*[1]]; test_ok(a == [[1]])
+*a = []; test_ok(a == [])
+*a = [1]; test_ok(a == [1])
+*a = [nil]; test_ok(a == [nil])
+*a = [[]]; test_ok(a == [[]])
+*a = [*[]]; test_ok(a == [])
+*a = [*[1]]; test_ok(a == [1])
*a = [*[1,2]]; test_ok(a == [1,2])
*a = *nil; test_ok(a == [])
@@ -77,19 +77,19 @@ a = *[*[1,2]]; test_ok(a == [1,2])
*a = *[]; test_ok(a == [])
*a = *[1]; test_ok(a == [1])
*a = *[nil]; test_ok(a == [])
-*a = *[[]]; test_ok(a == [[]])
+*a = *[[]]; test_ok(a == [])
*a = *[*[]]; test_ok(a == [])
*a = *[*[1]]; test_ok(a == [1])
*a = *[*[1,2]]; test_ok(a == [1,2])
a,b,*c = nil; test_ok([a,b,c] == [nil, nil, []])
a,b,*c = 1; test_ok([a,b,c] == [1, nil, []])
-a,b,*c = []; test_ok([a,b,c] == [[], nil, []])
-a,b,*c = [1]; test_ok([a,b,c] == [[1], nil, []])
-a,b,*c = [nil]; test_ok([a,b,c] == [[nil], nil, []])
-a,b,*c = [[]]; test_ok([a,b,c] == [[[]], nil, []])
-a,b,*c = [*[]]; test_ok([a,b,c] == [[], nil, []])
-a,b,*c = [*[1]]; test_ok([a,b,c] == [[1], nil, []])
+a,b,*c = []; test_ok([a,b,c] == [nil, nil, []])
+a,b,*c = [1]; test_ok([a,b,c] == [1, nil, []])
+a,b,*c = [nil]; test_ok([a,b,c] == [nil, nil, []])
+a,b,*c = [[]]; test_ok([a,b,c] == [[], nil, []])
+a,b,*c = [*[]]; test_ok([a,b,c] == [nil, nil, []])
+a,b,*c = [*[1]]; test_ok([a,b,c] == [1, nil, []])
a,b,*c = [*[1,2]]; test_ok([a,b,c] == [1, 2, []])
a,b,*c = *nil; test_ok([a,b,c] == [nil, nil, []])
@@ -97,7 +97,7 @@ a,b,*c = *1; test_ok([a,b,c] == [1, nil, []])
a,b,*c = *[]; test_ok([a,b,c] == [nil, nil, []])
a,b,*c = *[1]; test_ok([a,b,c] == [1, nil, []])
a,b,*c = *[nil]; test_ok([a,b,c] == [nil, nil, []])
-a,b,*c = *[[]]; test_ok([a,b,c] == [[], nil, []])
+a,b,*c = *[[]]; test_ok([a,b,c] == [nil, nil, []])
a,b,*c = *[*[]]; test_ok([a,b,c] == [nil, nil, []])
a,b,*c = *[*[1]]; test_ok([a,b,c] == [1, nil, []])
a,b,*c = *[*[1,2]]; test_ok([a,b,c] == [1, 2, []])
@@ -124,12 +124,12 @@ def f; yield *[*[1,2]]; end; f {|a| test_ok(a == [1,2])}
def f; yield nil; end; f {|*a| test_ok(a == [])}
def f; yield 1; end; f {|*a| test_ok(a == [1])}
-def f; yield []; end; f {|*a| test_ok(a == [[]])}
-def f; yield [1]; end; f {|*a| test_ok(a == [[1]])}
-def f; yield [nil]; end; f {|*a| test_ok(a == [[nil]])}
-def f; yield [[]]; end; f {|*a| test_ok(a == [[[]]])}
-def f; yield [*[]]; end; f {|*a| test_ok(a == [[]])}
-def f; yield [*[1]]; end; f {|*a| test_ok(a == [[1]])}
+def f; yield []; end; f {|*a| test_ok(a == [])}
+def f; yield [1]; end; f {|*a| test_ok(a == [1])}
+def f; yield [nil]; end; f {|*a| test_ok(a == [nil])}
+def f; yield [[]]; end; f {|*a| test_ok(a == [[]])}
+def f; yield [*[]]; end; f {|*a| test_ok(a == [])}
+def f; yield [*[1]]; end; f {|*a| test_ok(a == [1])}
def f; yield [*[1,2]]; end; f {|*a| test_ok(a == [1,2])}
def f; yield *nil; end; f {|*a| test_ok(a == [])}
@@ -137,19 +137,19 @@ def f; yield *1; end; f {|*a| test_ok(a == [1])}
def f; yield *[]; end; f {|*a| test_ok(a == [])}
def f; yield *[1]; end; f {|*a| test_ok(a == [1])}
def f; yield *[nil]; end; f {|*a| test_ok(a == [])}
-def f; yield *[[]]; end; f {|*a| test_ok(a == [[]])}
+def f; yield *[[]]; end; f {|*a| test_ok(a == [])}
def f; yield *[*[]]; end; f {|*a| test_ok(a == [])}
def f; yield *[*[1]]; end; f {|*a| test_ok(a == [1])}
def f; yield *[*[1,2]]; end; f {|*a| test_ok(a == [1,2])}
def f; yield nil; end; f {|a,b,*c| test_ok([a,b,c] == [nil, nil, []])}
def f; yield 1; end; f {|a,b,*c| test_ok([a,b,c] == [1, nil, []])}
-def f; yield []; end; f {|a,b,*c| test_ok([a,b,c] == [[], nil, []])}
-def f; yield [1]; end; f {|a,b,*c| test_ok([a,b,c] == [[1], nil, []])}
-def f; yield [nil]; end; f {|a,b,*c| test_ok([a,b,c] == [[nil], nil, []])}
-def f; yield [[]]; end; f {|a,b,*c| test_ok([a,b,c] == [[[]], nil, []])}
-def f; yield [*[]]; end; f {|a,b,*c| test_ok([a,b,c] == [[], nil, []])}
-def f; yield [*[1]]; end; f {|a,b,*c| test_ok([a,b,c] == [[1], nil, []])}
+def f; yield []; end; f {|a,b,*c| test_ok([a,b,c] == [nil, nil, []])}
+def f; yield [1]; end; f {|a,b,*c| test_ok([a,b,c] == [1, nil, []])}
+def f; yield [nil]; end; f {|a,b,*c| test_ok([a,b,c] == [nil, nil, []])}
+def f; yield [[]]; end; f {|a,b,*c| test_ok([a,b,c] == [[], nil, []])}
+def f; yield [*[]]; end; f {|a,b,*c| test_ok([a,b,c] == [nil, nil, []])}
+def f; yield [*[1]]; end; f {|a,b,*c| test_ok([a,b,c] == [1, nil, []])}
def f; yield [*[1,2]]; end; f {|a,b,*c| test_ok([a,b,c] == [1, 2, []])}
def f; yield *nil; end; f {|a,b,*c| test_ok([a,b,c] == [nil, nil, []])}
@@ -157,7 +157,7 @@ def f; yield *1; end; f {|a,b,*c| test_ok([a,b,c] == [1, nil, []])}
def f; yield *[]; end; f {|a,b,*c| test_ok([a,b,c] == [nil, nil, []])}
def f; yield *[1]; end; f {|a,b,*c| test_ok([a,b,c] == [1, nil, []])}
def f; yield *[nil]; end; f {|a,b,*c| test_ok([a,b,c] == [nil, nil, []])}
-def f; yield *[[]]; end; f {|a,b,*c| test_ok([a,b,c] == [[], nil, []])}
+def f; yield *[[]]; end; f {|a,b,*c| test_ok([a,b,c] == [nil, nil, []])}
def f; yield *[*[]]; end; f {|a,b,*c| test_ok([a,b,c] == [nil, nil, []])}
def f; yield *[*[1]]; end; f {|a,b,*c| test_ok([a,b,c] == [1, nil, []])}
def f; yield *[*[1,2]]; end; f {|a,b,*c| test_ok([a,b,c] == [1, 2, []])}
@@ -666,17 +666,17 @@ test_ok($x == 8)
IterTest.new([[0]]).each0 { |x| $x = x }
test_ok($x == [0])
IterTest.new([[1]]).each1 { |x| $x = x }
-test_ok($x == [1])
+test_ok($x == 1)
IterTest.new([[2]]).each2 { |x| $x = x }
-test_ok($x == [[2]])
+test_ok($x == [2])
IterTest.new([[3]]).each3 { |x| $x = x }
test_ok($x == 3)
IterTest.new([[4]]).each4 { |x| $x = x }
test_ok($x == [4])
IterTest.new([[5]]).each5 { |x| $x = x }
-test_ok($x == [5])
+test_ok($x == 5)
IterTest.new([[6]]).each6 { |x| $x = x }
-test_ok($x == [[6]])
+test_ok($x == [6])
IterTest.new([[7]]).each7 { |x| $x = x }
test_ok($x == 7)
IterTest.new([[8]]).each8 { |x| $x = x }