Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/SourceSectionTest.java @ 22266:0d36601f233e
Merge revised Instrumentation framework into the Polyglot API
- Required language implementation support now in TruffleLanguage
- Instrumentation services provided by the new Instrumenter class
- Reduced public API exposure; communication with other components via Accessor
- Several methods removed from the Node class
- Many test rewritten or using a new "test mode" because of limited access to Engine services
Merge with c66f520ad8562b906a878e9b3293aaf54270db90
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Wed, 30 Sep 2015 16:33:56 -0700 |
parents | 14e6dfb1ef05 |
children | 5309cc9668e3 |
comparison
equal
deleted
inserted
replaced
22202:3d9e283e2487 | 22266:0d36601f233e |
---|---|
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 */ | 22 */ |
23 package com.oracle.truffle.api.dsl.test; | 23 package com.oracle.truffle.api.dsl.test; |
24 | 24 |
25 import static com.oracle.truffle.api.dsl.test.TestHelper.createRoot; | |
26 import static com.oracle.truffle.api.dsl.test.TestHelper.createRootPrefix; | |
27 import static com.oracle.truffle.api.dsl.test.TestHelper.executeWith; | |
28 import static org.hamcrest.CoreMatchers.is; | |
29 import static org.hamcrest.CoreMatchers.sameInstance; | |
30 import static org.junit.Assert.assertNull; | |
31 import static org.junit.Assert.assertThat; | |
32 | |
33 import org.junit.After; | |
34 import org.junit.Before; | |
35 import org.junit.Test; | |
36 import org.junit.experimental.theories.DataPoints; | |
37 import org.junit.experimental.theories.Theories; | |
38 import org.junit.experimental.theories.Theory; | |
39 import org.junit.runner.RunWith; | |
40 | |
25 import com.oracle.truffle.api.dsl.CreateCast; | 41 import com.oracle.truffle.api.dsl.CreateCast; |
26 import com.oracle.truffle.api.dsl.Fallback; | 42 import com.oracle.truffle.api.dsl.Fallback; |
27 import com.oracle.truffle.api.dsl.NodeChild; | 43 import com.oracle.truffle.api.dsl.NodeChild; |
28 import com.oracle.truffle.api.dsl.Specialization; | 44 import com.oracle.truffle.api.dsl.Specialization; |
29 import com.oracle.truffle.api.dsl.internal.SpecializationNode; | 45 import com.oracle.truffle.api.dsl.internal.SpecializationNode; |
30 import com.oracle.truffle.api.dsl.test.SourceSectionTestFactory.SourceSection0Factory; | 46 import com.oracle.truffle.api.dsl.test.SourceSectionTestFactory.SourceSection0Factory; |
31 import com.oracle.truffle.api.dsl.test.SourceSectionTestFactory.SourceSection1Factory; | 47 import com.oracle.truffle.api.dsl.test.SourceSectionTestFactory.SourceSection1Factory; |
32 import static com.oracle.truffle.api.dsl.test.TestHelper.createRoot; | |
33 import static com.oracle.truffle.api.dsl.test.TestHelper.createRootPrefix; | |
34 import static com.oracle.truffle.api.dsl.test.TestHelper.executeWith; | |
35 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ArgumentNode; | 48 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ArgumentNode; |
36 import com.oracle.truffle.api.dsl.test.TypeSystemTest.TestRootNode; | 49 import com.oracle.truffle.api.dsl.test.TypeSystemTest.TestRootNode; |
37 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode; | 50 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode; |
51 import com.oracle.truffle.api.dsl.test.utilities.InstrumentationTestMode; | |
38 import com.oracle.truffle.api.nodes.Node; | 52 import com.oracle.truffle.api.nodes.Node; |
39 import com.oracle.truffle.api.source.SourceSection; | 53 import com.oracle.truffle.api.source.SourceSection; |
40 import static org.hamcrest.CoreMatchers.is; | |
41 import static org.hamcrest.CoreMatchers.sameInstance; | |
42 import static org.junit.Assert.assertNull; | |
43 import static org.junit.Assert.assertThat; | |
44 import org.junit.Test; | |
45 import org.junit.experimental.theories.DataPoints; | |
46 import org.junit.experimental.theories.Theories; | |
47 import org.junit.experimental.theories.Theory; | |
48 import org.junit.runner.RunWith; | |
49 | 54 |
50 @RunWith(Theories.class) | 55 @RunWith(Theories.class) |
51 public class SourceSectionTest { | 56 public class SourceSectionTest { |
52 | 57 |
53 @DataPoints public static final int[] data = new int[]{1, 2, 3, 4}; | 58 @DataPoints public static final int[] data = new int[]{1, 2, 3, 4}; |
59 | |
60 @Before | |
61 public void before() { | |
62 InstrumentationTestMode.set(true); | |
63 } | |
64 | |
65 @After | |
66 public void after() { | |
67 InstrumentationTestMode.set(false); | |
68 } | |
54 | 69 |
55 @Theory | 70 @Theory |
56 public void testSourceSections(int value0, int value1, int value2) { | 71 public void testSourceSections(int value0, int value1, int value2) { |
57 TestRootNode<SourceSection0> root = createRoot(SourceSection0Factory.getInstance()); | 72 TestRootNode<SourceSection0> root = createRoot(SourceSection0Factory.getInstance()); |
58 SourceSection section = SourceSection.createUnavailable("a", "b"); | 73 SourceSection section = SourceSection.createUnavailable("a", "b"); |