Mercurial > hg > graal-compiler
annotate 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 |
rev | line source |
---|---|
13514 | 1 /* |
2 * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. This | |
3 * code is released under a tri EPL/GPL/LGPL license. You can use it, | |
4 * redistribute it and/or modify it under the terms of the: | |
5 * | |
6 * Eclipse Public License version 1.0 | |
7 * GNU General Public License version 2 | |
8 * GNU Lesser General Public License version 2.1 | |
9 */ | |
10 package com.oracle.truffle.ruby.test.core; | |
11 | |
12 import org.junit.*; | |
13 | |
14 import com.oracle.truffle.ruby.test.*; | |
15 | |
16 /** | |
17 * Test the {@code Continuation} class. | |
18 */ | |
19 public class ContinuationTests extends RubyTests { | |
20 | |
21 @Test | |
13645
497fada09efb
Ruby: remove versioning.
Chris Seaton <chris.seaton@oracle.com>
parents:
13514
diff
changeset
|
22 public void testRequired() { |
13659
62bfc12dc9e1
Ruby: more tidy up.
Chris Seaton <chris.seaton@oracle.com>
parents:
13645
diff
changeset
|
23 assertPrints("", "callcc { |c| c.call }"); |
13514 | 24 } |
25 | |
26 @Test | |
27 public void testOneShotGoingUpCallstack() { | |
13659
62bfc12dc9e1
Ruby: more tidy up.
Chris Seaton <chris.seaton@oracle.com>
parents:
13645
diff
changeset
|
28 assertPrints("1\n3\n", "callcc { |c| puts 1; c.call; puts 2 }; puts 3"); |
13514 | 29 } |
30 | |
31 @Test | |
32 public void testOneShotGoingUpCallstackReturnValue() { | |
13659
62bfc12dc9e1
Ruby: more tidy up.
Chris Seaton <chris.seaton@oracle.com>
parents:
13645
diff
changeset
|
33 assertPrints("14\n", "puts callcc { |c| c.call 14 }"); |
13514 | 34 } |
35 | |
36 @Test | |
37 public void testNestedOneShotGoingUpCallstack() { | |
13659
62bfc12dc9e1
Ruby: more tidy up.
Chris Seaton <chris.seaton@oracle.com>
parents:
13645
diff
changeset
|
38 assertPrints("1\n2\n4\n5\n", "callcc { |c1| puts 1; callcc { |c2| puts 2; c2.call; puts 3 }; puts 4 }; puts 5"); |
62bfc12dc9e1
Ruby: more tidy up.
Chris Seaton <chris.seaton@oracle.com>
parents:
13645
diff
changeset
|
39 assertPrints("1\n2\n5\n", "callcc { |c1| puts 1; callcc { |c2| puts 2; c1.call; puts 3 }; puts 4 }; puts 5"); |
13514 | 40 } |
41 | |
42 } |