From 87a414af2bc30f33b3f99383a264f0f8e900fe00 Mon Sep 17 00:00:00 2001 From: ko1 Date: Fri, 5 Jan 2007 03:43:12 +0000 Subject: * compile.c (iseq_compile_each, set_block_local_tbl) : support NODE_LAMBDA (partly). * sample/test.rb : restore test of NODE_LAMBDA * test/ruby/test_lambda.rb : ditto git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@11477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_lambda.rb | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'test/ruby') diff --git a/test/ruby/test_lambda.rb b/test/ruby/test_lambda.rb index 5687722c3..b4f0dac65 100644 --- a/test/ruby/test_lambda.rb +++ b/test/ruby/test_lambda.rb @@ -1,14 +1,6 @@ require 'test/unit' class TestLambdaParameters < Test::Unit::TestCase - def test_not_supported - flunk("YARV doesn't support NODE_LAMBDA") - end -end - -__END__ - -class TestLambdaParametersBackup def test_call_simple assert_equal(1, ->(a){ a }.call(1)) assert_equal([1,2], ->(a,b){ [a,b] }.call(1,2)) @@ -18,6 +10,20 @@ class TestLambdaParametersBackup assert_raises(ArgumentError) { ->(a,b){ }.call(1,2,3) } end + def test_lambda_as_iterator + a = 0 + 2.times(&->(_){ a += 1 }) + assert_equal(a, 2) + end + + def test_message + flunk("YARV doesn't support some argument types for Proc object created by '->' syntax") + end +end + +__END__ + +class TestLambdaParameters def test_call_rest_args assert_equal([1,2], ->(*a){ a }.call(1,2)) assert_equal([1,2,[]], ->(a,b,*c){ [a,b,c] }.call(1,2)) @@ -52,10 +58,4 @@ class TestLambdaParametersBackup def foo assert_equal(nil, ->(&b){ b }.call) end - - def test_lambda_as_iterator - a = 0 - 2.times(&->(_){ a += 1 }) - assert_equal(a, 2) - end end -- cgit