mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* sample/test.rb: update test suites.
* test/ruby/test_assignment.rb (TestAssignment::test_yield): ditto. * test/ruby/test_iterator.rb (TestIterator::test_itertest): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c4ad5309f9
commit
a1a07fbfa1
4 changed files with 36 additions and 21 deletions
|
@ -1,3 +1,11 @@
|
|||
Mon Jul 10 17:32:38 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* sample/test.rb: update test suites.
|
||||
|
||||
* test/ruby/test_assignment.rb (TestAssignment::test_yield): ditto.
|
||||
|
||||
* test/ruby/test_iterator.rb (TestIterator::test_itertest): ditto.
|
||||
|
||||
Mon Jul 10 14:43:47 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* eval.c (rb_call): remove erroneously restored prot_tag->blkid
|
||||
|
|
|
@ -127,6 +127,13 @@ a,b,*c = *[*[1,2]]; test_ok([a,b,c] == [1,2,[]])
|
|||
|
||||
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 [*[]]; 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])}
|
||||
|
|
|
@ -82,18 +82,18 @@ class TestAssignment < Test::Unit::TestCase
|
|||
def test_yield
|
||||
def f; yield(nil); end; f {|a| assert_nil(a)}; undef f
|
||||
def f; yield(1); end; f {|a| assert_equal(1, a)}; undef f
|
||||
def f; yield([]); end; f {|a| assert_equal(nil, a)}; undef f
|
||||
def f; yield([1]); end; f {|a| assert_equal(1, a)}; undef f
|
||||
def f; yield([nil]); end; f {|a| assert_equal(nil, a)}; undef f
|
||||
def f; yield([[]]); end; f {|a| assert_equal([], a)}; undef f
|
||||
def f; yield([*[]]); end; f {|a| assert_equal(nil, a)}; undef f
|
||||
def f; yield([*[1]]); end; f {|a| assert_equal(1, a)}; undef f
|
||||
def f; yield([*[1,2]]); end; f {|a| assert_equal(1, a)}; undef f
|
||||
def f; yield([]); end; f {|a| assert_equal([], a)}; undef f
|
||||
def f; yield([1]); end; f {|a| assert_equal([1], a)}; undef f
|
||||
def f; yield([nil]); end; f {|a| assert_equal([nil], a)}; undef f
|
||||
def f; yield([[]]); end; f {|a| assert_equal([[]], a)}; undef f
|
||||
def f; yield([*[]]); end; f {|a| assert_equal([], a)}; undef f
|
||||
def f; yield([*[1]]); end; f {|a| assert_equal([1], a)}; undef f
|
||||
def f; yield([*[1,2]]); end; f {|a| assert_equal([1,2], a)}; undef f
|
||||
|
||||
def f; yield(*[1]); end; f {|a| assert_equal(1, a)}; undef f
|
||||
def f; yield(*[nil]); end; f {|a| assert_nil(a)}; undef f
|
||||
def f; yield(*[[]]); end; f {|a| assert_equal([], a)}; undef f
|
||||
def f; yield(*[*[1]]); end; f {|a| assert_equal(1, a)}; undef f
|
||||
def f; yield(*[1]); end; f {|a| assert_equal([1], a)}; undef f
|
||||
def f; yield(*[nil]); end; f {|a| assert_equal([nil], a)}; undef f
|
||||
def f; yield(*[[]]); end; f {|a| assert_equal([[]], a)}; undef f
|
||||
def f; yield(*[*[1]]); end; f {|a| assert_equal([1], a)}; undef f
|
||||
|
||||
def f; yield; end; f {|*a| assert_equal([], a)}; undef f
|
||||
def f; yield(nil); end; f {|*a| assert_equal([nil], a)}; undef f
|
||||
|
|
|
@ -150,22 +150,22 @@ class TestIterator < Test::Unit::TestCase
|
|||
IterTest.new([1]).each1 {|x| assert_equal(1, x)}
|
||||
IterTest.new([2]).each2 {|x| assert_equal([2], x)}
|
||||
IterTest.new([4]).each4 {|x| assert_equal(4, x)}
|
||||
IterTest.new([5]).each5 {|x| assert_equal(5, x)}
|
||||
IterTest.new([6]).each6 {|x| assert_equal(6, x)}
|
||||
IterTest.new([5]).each5 {|x| assert_equal([5], x)}
|
||||
IterTest.new([6]).each6 {|x| assert_equal([6], x)}
|
||||
IterTest.new([8]).each8 {|x| assert_equal(8, x)}
|
||||
|
||||
IterTest.new([[0]]).each0 {|x| assert_equal(0, x)}
|
||||
IterTest.new([[0]]).each0 {|x| assert_equal([0], x)}
|
||||
IterTest.new([[1]]).each1 {|x| assert_equal(1, x)}
|
||||
IterTest.new([[2]]).each2 {|x| assert_equal([2], x)}
|
||||
IterTest.new([[3]]).each3 {|x| assert_equal(3, x)}
|
||||
IterTest.new([[4]]).each4 {|x| assert_equal(4, x)}
|
||||
IterTest.new([[5]]).each5 {|x| assert_equal(5, x)}
|
||||
IterTest.new([[6]]).each6 {|x| assert_equal(6, x)}
|
||||
IterTest.new([[7]]).each7 {|x| assert_equal(7, x)}
|
||||
IterTest.new([[8]]).each8 {|x| assert_equal(8, x)}
|
||||
IterTest.new([[4]]).each4 {|x| assert_equal([4], x)}
|
||||
IterTest.new([[5]]).each5 {|x| assert_equal([5], x)}
|
||||
IterTest.new([[6]]).each6 {|x| assert_equal([6], x)}
|
||||
IterTest.new([[7]]).each7 {|x| assert_equal([7], x)}
|
||||
IterTest.new([[8]]).each8 {|x| assert_equal([8], x)}
|
||||
|
||||
IterTest.new([[0,0]]).each0 {|*x| assert_equal([0,0], x)}
|
||||
IterTest.new([[8,8]]).each8 {|*x| assert_equal([8], x)}
|
||||
IterTest.new([[8,8]]).each8 {|*x| assert_equal([8,8], x)}
|
||||
end
|
||||
|
||||
def m(var)
|
||||
|
@ -365,7 +365,7 @@ class TestIterator < Test::Unit::TestCase
|
|||
|
||||
def test_assoc_yield
|
||||
[{:key=>:value}, H.new].each {|h|
|
||||
h.each{|a| assert_equal(:key, a)}
|
||||
h.each{|a| assert_equal([:key, :value], a)}
|
||||
h.each{|*a| assert_equal([:key, :value], a)}
|
||||
h.each{|k,v| assert_equal([:key, :value], [k,v])}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue