@@ -313,6 +313,7 @@ def evaluate_with_output(input)
313313 [ "[1, 2, 3]" , "[1, 2, 3]" ] ,
314314 [ "[1, 2, 3].include?(2)" , "true" ] ,
315315 [ "[1, 2, 3].include?(4)" , "false" ] ,
316+ [ "[1, 2, 3].map { |i| continue(0) if i.even? i ** 2}" , "[1, 0, 9]" ] ,
316317 [ "[1, 2, 3].map { |i| next if i == 2 i ** 2}" , "[1, nothing, 9]" ] ,
317318 [ "[1, 2, 3].map { |i| next(0) if i.even? i ** 2}" , "[1, 0, 9]" ] ,
318319 [ "[1, 2, 3].select { |n| n.even? }" , "[2]" ] ,
@@ -328,9 +329,17 @@ def evaluate_with_output(input)
328329 [ "[]" , "[]" ] ,
329330 [ "\r \n " , "nothing" ] ,
330331 [ "a = 0 [1, 2, 3].each { |i| next if i == 2 a += i } a" , "4" ] ,
332+ [ "a = 0\n b = 0\n while a < 4\n a += 1\n continue if a == 2\n b += a\n end\n b" , "8" ] ,
331333 [ "a = 0 loop a += 1 break end a" , "1" ] ,
334+ [ "a = 1\n begin\n a += 1\n break if a > 3\n retry\n end\n a" , "4" ] ,
335+ [ "x = loop break(42) end x" , "42" ] ,
336+ [ "a = 0 a += 1 retry if a < 3 a" , "3" ] ,
332337 [ "a = 0\n until a > 10 a += 1 end a" , "11" ] ,
333338 [ "a = 0\n while a < 10 a += 1 end a" , "10" ] ,
339+ [
340+ "a = 0\n retried = false\n while a < 2\n a += 1\n retry if a == 1 && !retried && (retried = true)\n end\n a" ,
341+ "2"
342+ ] ,
334343 [ "a = 1 3.times { a += 1 } a" , "4" ] ,
335344 [ "a = 1 a *= 2 a" , "2" ] ,
336345 [ "a = 1 a += 1 a" , "2" ] ,
@@ -360,9 +369,15 @@ def evaluate_with_output(input)
360369 [ "if false 1 elsif false 2" , "nothing" ] ,
361370 [ "if false 1 elsif true 2" , "2" ] ,
362371 [ "if false 1" , "nothing" ] ,
372+ [ "break(5)" , "5" ] ,
373+ [ "continue(6)" , "6" ] ,
363374 [ "if true 1" , "1" ] ,
375+ [ "next(7)" , "7" ] ,
364376 [ "not not false" , "false" ] ,
365377 [ "not true" , "false" ] ,
378+ [ "retry(8)" , "8" ] ,
379+ [ "return(9)" , "9" ] ,
380+ [ "f = () => { return(3) 4 } f()" , "3" ] ,
366381 [ "a = 1 orirginal = 2 orirginal" , "2" ] ,
367382 [ "a = 1 andy = 2 andy" , "2" ] ,
368383 [ "ifonly = 1 ifonly" , "1" ] ,
0 commit comments