comparison graal/com.oracle.truffle.ruby.test/src/com/oracle/truffle/ruby/test/core/ContinuationTests.java @ 13659:62bfc12dc9e1

Ruby: more tidy up.
author Chris Seaton <chris.seaton@oracle.com>
date Wed, 15 Jan 2014 19:54:48 +0000
parents 497fada09efb
children
comparison
equal deleted inserted replaced
13658:50c11b9a7fdf 13659:62bfc12dc9e1
18 */ 18 */
19 public class ContinuationTests extends RubyTests { 19 public class ContinuationTests extends RubyTests {
20 20
21 @Test 21 @Test
22 public void testRequired() { 22 public void testRequired() {
23 assertPrints("", "require \"continuation\"; callcc { |c| c.call }"); 23 assertPrints("", "callcc { |c| c.call }");
24 } 24 }
25 25
26 @Test 26 @Test
27 public void testOneShotGoingUpCallstack() { 27 public void testOneShotGoingUpCallstack() {
28 assertPrints("1\n3\n", "require \"continuation\"; callcc { |c| puts 1; c.call; puts 2 }; puts 3"); 28 assertPrints("1\n3\n", "callcc { |c| puts 1; c.call; puts 2 }; puts 3");
29 } 29 }
30 30
31 @Test 31 @Test
32 public void testOneShotGoingUpCallstackReturnValue() { 32 public void testOneShotGoingUpCallstackReturnValue() {
33 assertPrints("14\n", "require \"continuation\"; puts callcc { |c| c.call 14 }"); 33 assertPrints("14\n", "puts callcc { |c| c.call 14 }");
34 } 34 }
35 35
36 @Test 36 @Test
37 public void testNestedOneShotGoingUpCallstack() { 37 public void testNestedOneShotGoingUpCallstack() {
38 assertPrints("1\n2\n4\n5\n", "require \"continuation\"; callcc { |c1| puts 1; callcc { |c2| puts 2; c2.call; puts 3 }; puts 4 }; puts 5"); 38 assertPrints("1\n2\n4\n5\n", "callcc { |c1| puts 1; callcc { |c2| puts 2; c2.call; puts 3 }; puts 4 }; puts 5");
39 assertPrints("1\n2\n5\n", "require \"continuation\"; callcc { |c1| puts 1; callcc { |c2| puts 2; c1.call; puts 3 }; puts 4 }; puts 5"); 39 assertPrints("1\n2\n5\n", "callcc { |c1| puts 1; callcc { |c2| puts 2; c1.call; puts 3 }; puts 4 }; puts 5");
40 } 40 }
41 41
42 } 42 }