Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/SourceSectionTest.java @ 21987:b2d1c8ff592a
Less classes in the source API package. Merging interfaces and their only implementation into final classes. Hiding NullSourceSection behind factory method. Using JDK's standard CharsetDecoder instead of proprietary BytesDecoder.
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Wed, 01 Jul 2015 10:23:36 +0200 |
parents | 9c8c0937da41 |
children | dc83cc1f94f2 |
comparison
equal
deleted
inserted
replaced
21986:67ea94a23074 | 21987:b2d1c8ff592a |
---|---|
46 @DataPoints public static final int[] data = new int[]{1, 2, 3, 4}; | 46 @DataPoints public static final int[] data = new int[]{1, 2, 3, 4}; |
47 | 47 |
48 @Theory | 48 @Theory |
49 public void testSourceSections(int value0, int value1, int value2) { | 49 public void testSourceSections(int value0, int value1, int value2) { |
50 TestRootNode<SourceSection0> root = createRoot(SourceSection0Factory.getInstance()); | 50 TestRootNode<SourceSection0> root = createRoot(SourceSection0Factory.getInstance()); |
51 SourceSection section = new NullSourceSection("a", "b"); | 51 SourceSection section = SourceSection.createUnavailable("a", "b"); |
52 root.getNode().assignSourceSection(section); | 52 root.getNode().assignSourceSection(section); |
53 expectSourceSection(root.getNode(), section); | 53 expectSourceSection(root.getNode(), section); |
54 assertThat((int) executeWith(root, value0), is(value0)); | 54 assertThat((int) executeWith(root, value0), is(value0)); |
55 expectSourceSection(root.getNode(), section); | 55 expectSourceSection(root.getNode(), section); |
56 assertThat((int) executeWith(root, value1), is(value1)); | 56 assertThat((int) executeWith(root, value1), is(value1)); |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 @Test | 98 @Test |
99 public void testCreateCast() { | 99 public void testCreateCast() { |
100 SourceSection section = new NullSourceSection("a", "b"); | 100 SourceSection section = SourceSection.createUnavailable("a", "b"); |
101 assertNull(section.getSource()); | |
101 TestRootNode<SourceSection1> root = createRootPrefix(SourceSection1Factory.getInstance(), true, section); | 102 TestRootNode<SourceSection1> root = createRootPrefix(SourceSection1Factory.getInstance(), true, section); |
102 expectSourceSection(root.getNode(), section); | 103 expectSourceSection(root.getNode(), section); |
103 assertThat((int) executeWith(root, 1), is(1)); | 104 assertThat((int) executeWith(root, 1), is(1)); |
104 expectSourceSection(root.getNode(), section); | 105 expectSourceSection(root.getNode(), section); |
105 } | 106 } |