mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	add tests for "break" in lambda.
This commit is contained in:
		
							parent
							
								
									8ac1c6eb48
								
							
						
					
					
						commit
						bd494ae79b
					
				
					 1 changed files with 15 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -157,6 +157,21 @@ class TestLambdaParameters < Test::Unit::TestCase
 | 
			
		|||
    assert_equal(42, return_in_callee(42), feature8693)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def break_in_current(val)
 | 
			
		||||
    1.tap(&->(*) {break 0})
 | 
			
		||||
    val
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def break_in_callee(val)
 | 
			
		||||
    yield_block(&->(*) {break 0})
 | 
			
		||||
    val
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_break
 | 
			
		||||
    assert_equal(42, break_in_current(42))
 | 
			
		||||
    assert_equal(42, break_in_callee(42))
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_do_lambda_source_location
 | 
			
		||||
    exp_lineno = __LINE__ + 3
 | 
			
		||||
    lmd = ->(x,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue