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

* sample/test.rb: import matzruby's sample/test.rb.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2007-05-01 09:47:24 +00:00
parent 82d5106e09
commit 9ca1fec41b
2 changed files with 30 additions and 26 deletions

View file

@ -1,3 +1,7 @@
Tue May 1 18:45:45 2007 Koichi Sasada <ko1@atdot.net>
* sample/test.rb: import matzruby's sample/test.rb.
Tue May 1 17:46:05 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* array.c (rb_ary_choice): a new method to choose an element

View file

@ -134,13 +134,13 @@ 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 *[]; 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 *[]; end; f {|a| test_ok(a == nil)}
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 == nil)}
def f; yield *[*[1]]; end; f {|a| test_ok(a == 1)}
def f; yield *[*[1,2]]; end; f {|a| test_ok(a == 1)}
def f; yield; end; f {|a,| test_ok(a == nil)}
def f; yield nil; end; f {|a,| test_ok(a == nil)}
@ -156,7 +156,7 @@ def f; yield [*[1,2]]; end; f {|a,| test_ok(a == 1)}
def f; yield *[]; end; f {|a,| test_ok(a == nil)}
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 == nil)}
def f; yield *[*[]]; end; f {|a,| test_ok(a == nil)}
def f; yield *[*[1]]; end; f {|a,| test_ok(a == 1)}
def f; yield *[*[1,2]]; end; f {|a,| test_ok(a == 1)}
@ -164,14 +164,14 @@ def f; yield *[*[1,2]]; end; f {|a,| test_ok(a == 1)}
def f; yield; end; f {|*a| test_ok(a == [])}
def f; yield nil; end; f {|*a| test_ok(a == [nil])}
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 [1,2]; end; f {|*a| test_ok(a == [1,2])}
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 []; 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 [1,2]; end; f {|*a| test_ok(a == [[1,2]])}
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 *[]; end; f {|*a| test_ok(a == [])}
def f; yield *[1]; end; f {|*a| test_ok(a == [1])}
@ -195,7 +195,7 @@ def f; yield [*[1,2]]; end; f {|a,b,*c| test_ok([a,b,c] == [1,2,[]])}
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,[]])}
@ -965,23 +965,23 @@ IterTest.new([1]).each1 {|x| test_ok(x == 1)}
IterTest.new([2]).each2 {|x| test_ok(x == [2])}
#IterTest.new([3]).each3 {|x| test_ok(x == 3)}
IterTest.new([4]).each4 {|x| test_ok(x == 4)}
IterTest.new([5]).each5 {|x| test_ok(x == [5])}
IterTest.new([5]).each5 {|x| test_ok(x == 5)}
IterTest.new([6]).each6 {|x| test_ok(x == [6])}
#IterTest.new([7]).each7 {|x| test_ok(x == 7)}
IterTest.new([8]).each8 {|x| test_ok(x == 8)}
IterTest.new([[0]]).each0 {|x| test_ok(x == [0])}
IterTest.new([[1]]).each1 {|x| test_ok(x == 1)}
IterTest.new([[2]]).each2 {|x| test_ok(x == [2])}
IterTest.new([[1]]).each1 {|x| test_ok(x == [1])}
IterTest.new([[2]]).each2 {|x| test_ok(x == [[2]])}
IterTest.new([[3]]).each3 {|x| test_ok(x == 3)}
IterTest.new([[4]]).each4 {|x| test_ok(x == [4])}
IterTest.new([[5]]).each5 {|x| test_ok(x == [5])}
IterTest.new([[6]]).each6 {|x| test_ok(x == [6])}
IterTest.new([[7]]).each7 {|x| test_ok(x == [7])}
IterTest.new([[6]]).each6 {|x| test_ok(x == [[6]])}
IterTest.new([[7]]).each7 {|x| test_ok(x == 7)}
IterTest.new([[8]]).each8 {|x| test_ok(x == [8])}
IterTest.new([[0,0]]).each0 {|*x| test_ok(x == [0,0])}
IterTest.new([[8,8]]).each8 {|*x| test_ok(x == [8,8])}
IterTest.new([[0,0]]).each0 {|*x| test_ok(x == [[0,0]])}
IterTest.new([[8,8]]).each8 {|*x| test_ok(x == [[8,8]])}
def m0(v)
v
@ -1074,8 +1074,8 @@ test_ok(block_get(&lmd).class == Proc)
test_ok(Proc.new{|a,| a}.yield(1,2,3) == 1)
call_argument_test(true, Proc.new{|a,|}, 1,2)
#! test_ok(Proc.new{|&b| b.call(10)}.call {|x| x} == 10)
#! test_ok(Proc.new{|a,&b| b.call(a)}.call(12) {|x| x} == 12)
test_ok(Proc.new{|&b| b.call(10)}.call {|x| x} == 10)
test_ok(Proc.new{|a,&b| b.call(a)}.call(12) {|x| x} == 12)
def test_return1
Proc.new {