summaryrefslogtreecommitdiff
path: root/yarvtest
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-23 09:38:08 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-23 09:38:08 +0000
commitbd3ee06295a54b714282d71bca309c86f1869aa9 (patch)
tree62dd4e250cc53680f48f4784e63c4e45c9ecf2cf /yarvtest
parentbb022bed3a0e20b6fee92ad8910d1e0651c43f18 (diff)
* test/ruby/test_yield.rb: new test.
* yarvtest/test_yield.rb: removed (moved to test_yield.rb). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'yarvtest')
-rw-r--r--yarvtest/test_yield.rb207
1 files changed, 0 insertions, 207 deletions
diff --git a/yarvtest/test_yield.rb b/yarvtest/test_yield.rb
deleted file mode 100644
index 56fa48b0c8..0000000000
--- a/yarvtest/test_yield.rb
+++ /dev/null
@@ -1,207 +0,0 @@
-require 'yarvtest/yarvtest'
-class TestYield < YarvTestBase
- def test_simple
- ae %q{
- def iter
- yield
- end
- iter{
- 1
- }
- }
- end
-
- def test_hash_each
- ae %q{
- h = {:a => 1}
- a = []
- h.each{|k, v|
- a << [k, v]
- }
- h.each{|kv|
- a << kv
- }
- a
- }
- end
-
- def test_ary_each
- ae %q{
- ans = []
- ary = [1,2,3]
- ary.each{|a, b, c, d|
- ans << [a, b, c, d]
- }
- ary.each{|a, b, c|
- ans << [a, b, c]
- }
- ary.each{|a, b|
- ans << [a, b]
- }
- ary.each{|a|
- ans << [a]
- }
- ans
- }
- end
-
- def test_iter
- ae %q{
- def iter *args
- yield *args
- end
-
- ans = []
- ary = [1,2,3]
- ary.each{|a, b, c, d|
- ans << [a, b, c, d]
- }
- ary.each{|a, b, c|
- ans << [a, b, c]
- }
- ary.each{|a, b|
- ans << [a, b]
- }
- ary.each{|a|
- ans << [a]
- }
- ans
- }
- end
-
- def test_iter2
- ae %q{
- def iter args
- yield *args
- end
- ans = []
- iter([]){|a, b|
- ans << [a, b]
- }
- iter([1]){|a, b|
- ans << [a, b]
- }
- iter([1, 2]){|a, b|
- ans << [a, b]
- }
- iter([1, 2, 3]){|a, b|
- ans << [a, b]
- }
- ans
- }
- ae %q{
- def iter args
- yield *args
- end
- ans = []
-
- iter([]){|a|
- ans << a
- }
- iter([1]){|a|
- ans << a
- }
- iter([1, 2]){|a|
- ans << a
- }
- iter([1, 2, 3]){|a|
- ans << a
- }
- ans
- }
- end
-
- def test_1_ary_and_n_params
- ae %q{
- def iter args
- yield args
- end
- ans = []
- iter([]){|a, b|
- ans << [a, b]
- }
- iter([1]){|a, b|
- ans << [a, b]
- }
- iter([1, 2]){|a, b|
- ans << [a, b]
- }
- iter([1, 2, 3]){|a, b|
- ans << [a, b]
- }
- ans
- }
- end
-
- def test_1_ary_and_1_params
- ae %q{
- def iter args
- yield args
- end
- ans = []
- iter([]){|a|
- ans << a
- }
- iter([1]){|a|
- ans << a
- }
- iter([1, 2]){|a|
- ans << a
- }
- iter([1, 2, 3]){|a|
- ans << a
- }
- ans
- }
- end
-
- def test_argscat
- ae %q{
- def iter
- yield 1, *[2, 3]
- end
-
- iter{|a, b, c|
- [a, b, c]
- }
- }
- ae %q{
- def iter
- yield 1, *[]
- end
-
- iter{|a, b, c|
- [a, b, c]
- }
- }
- if false
- ae %q{
- def iter
- yield 1, *2
- end
-
- iter{|a, b, c|
- [a, b, c]
- }
- }
- end
- end
-
- def test_massgin
- ae %q{
- ans = []
- [[1, [2, 3]], [4, [5, 6]]].each{|a, (b, c)|
- ans << [a, b, c]
- }
- ans
- }
- ae %q{
- ans = []
- [[1, [2, 3]], [4, [5, 6]]].map{|a, (b, c)|
- ans << [a, b, c]
- } + ans
- }
- end
-end
-
-