annotate truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/source/SourceSectionTest.java @ 22424:fec62e298245

Rename package truffle.api.test to truffle.api to enable package-protected API access for testing.
author Christian Humer <christian.humer@oracle.com>
date Wed, 02 Dec 2015 15:16:27 +0100
parents truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/source/SourceSectionTest.java@7a147c6abace
children b39b603e2a1e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21647
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
1 /*
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
4 *
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
8 *
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
13 * accompanied this code).
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
14 *
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
18 *
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
21 * questions.
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
22 */
22424
fec62e298245 Rename package truffle.api.test to truffle.api to enable package-protected API access for testing.
Christian Humer <christian.humer@oracle.com>
parents: 22395
diff changeset
23 package com.oracle.truffle.api.source;
21647
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
24
22292
0e13cbebc04c Truffle/Source: remove two previously @Ignored tests that are inconsistent with the current text model being used.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
25 import static org.junit.Assert.assertEquals;
0e13cbebc04c Truffle/Source: remove two previously @Ignored tests that are inconsistent with the current text model being used.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
26 import static org.junit.Assert.assertNotNull;
0e13cbebc04c Truffle/Source: remove two previously @Ignored tests that are inconsistent with the current text model being used.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
27
0e13cbebc04c Truffle/Source: remove two previously @Ignored tests that are inconsistent with the current text model being used.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
28 import org.junit.Test;
0e13cbebc04c Truffle/Source: remove two previously @Ignored tests that are inconsistent with the current text model being used.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
29
22157
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
30 import com.oracle.truffle.api.source.Source;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
31 import com.oracle.truffle.api.source.SourceSection;
21647
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
32
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
33 public class SourceSectionTest {
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
34
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
35 private final Source emptySource = Source.fromText("", null);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
36
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
37 private final Source emptyLineSource = Source.fromText("\n", null);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
38
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
39 private final Source shortSource = Source.fromText("01", null);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
40
22394
f56fa795a5a5 SourceSection: clearify string representations, add tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22292
diff changeset
41 private final Source longSource = Source.fromText("01234\n67\n9\n", "long");
21647
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
42
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
43 public void emptySourceTest0() {
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
44 SourceSection section = emptySource.createSection("test", 0, 0);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
45 assertNotNull(section);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
46 assertEquals(section.getCode(), "");
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
47 }
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
48
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
49 @Test
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
50 public void emptyLineTest0() {
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
51 SourceSection section = emptyLineSource.createSection("test", 0, 0);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
52 assertNotNull(section);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
53 assertEquals(section.getCode(), "");
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
54 assertEquals(section.getCharIndex(), 0);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
55 assertEquals(section.getCharLength(), 0);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
56 assertEquals(section.getStartLine(), 1);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
57 assertEquals(section.getStartColumn(), 1);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
58 }
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
59
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
60 @Test
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
61 public void emptyLineTest1() {
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
62 SourceSection section = emptyLineSource.createSection("test", 0, 1);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
63 assertNotNull(section);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
64 assertEquals(section.getCode(), "\n");
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
65 assertEquals(section.getCharIndex(), 0);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
66 assertEquals(section.getCharLength(), 1);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
67 assertEquals(section.getStartLine(), 1);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
68 assertEquals(section.getStartColumn(), 1);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
69 assertEquals(section.getEndLine(), 1);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
70 assertEquals(section.getEndColumn(), 1);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
71 }
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
72
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
73 @Test
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
74 public void emptySectionTest2() {
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
75 SourceSection section = shortSource.createSection("test", 0, 0);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
76 assertNotNull(section);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
77 assertEquals(section.getCode(), "");
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
78 }
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
79
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
80 @Test
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
81 public void emptySectionTest3() {
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
82 SourceSection section = longSource.createSection("test", 0, 0);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
83 assertNotNull(section);
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
84 assertEquals(section.getCode(), "");
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
85 }
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
86
22394
f56fa795a5a5 SourceSection: clearify string representations, add tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22292
diff changeset
87 @Test
f56fa795a5a5 SourceSection: clearify string representations, add tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22292
diff changeset
88 public void testGetCode() {
f56fa795a5a5 SourceSection: clearify string representations, add tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22292
diff changeset
89 assertEquals("01234", longSource.createSection("test", 0, 5).getCode());
f56fa795a5a5 SourceSection: clearify string representations, add tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22292
diff changeset
90 assertEquals("67", longSource.createSection("test", 6, 2).getCode());
f56fa795a5a5 SourceSection: clearify string representations, add tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22292
diff changeset
91 assertEquals("9", longSource.createSection("test", 9, 1).getCode());
f56fa795a5a5 SourceSection: clearify string representations, add tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22292
diff changeset
92 }
f56fa795a5a5 SourceSection: clearify string representations, add tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22292
diff changeset
93
f56fa795a5a5 SourceSection: clearify string representations, add tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22292
diff changeset
94 @Test
f56fa795a5a5 SourceSection: clearify string representations, add tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22292
diff changeset
95 public void testGetShortDescription() {
f56fa795a5a5 SourceSection: clearify string representations, add tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22292
diff changeset
96 assertEquals("long:1", longSource.createSection("test", 0, 5).getShortDescription());
f56fa795a5a5 SourceSection: clearify string representations, add tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22292
diff changeset
97 assertEquals("long:2", longSource.createSection("test", 6, 2).getShortDescription());
f56fa795a5a5 SourceSection: clearify string representations, add tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22292
diff changeset
98 assertEquals("long:3", longSource.createSection("test", 9, 1).getShortDescription());
f56fa795a5a5 SourceSection: clearify string representations, add tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22292
diff changeset
99 }
22395
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
100
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
101 @Test(expected = IllegalArgumentException.class)
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
102 public void testOutOfRange1() {
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
103 longSource.createSection("test", 9, 5);
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
104 }
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
105
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
106 @Test(expected = IllegalArgumentException.class)
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
107 public void testOutOfRange2() {
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
108 longSource.createSection("test", -1, 1);
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
109 }
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
110
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
111 @Test(expected = IllegalArgumentException.class)
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
112 public void testOutOfRange3() {
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
113 longSource.createSection("test", 1, -1);
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
114 }
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
115
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
116 @Test(expected = IllegalArgumentException.class)
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
117 public void testOutOfRange4() {
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
118 longSource.createSection("test", 3, 1, 9, 5);
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
119 }
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
120
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
121 @Test(expected = IllegalArgumentException.class)
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
122 public void testOutOfRange5() {
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
123 longSource.createSection("test", 1, 1, -1, 1);
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
124 }
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
125
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
126 @Test(expected = IllegalArgumentException.class)
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
127 public void testOutOfRange6() {
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
128 longSource.createSection("test", 1, 1, 1, -1);
7a147c6abace SourceSection: add position/length out of range tests
Andreas Woess <andreas.woess@oracle.com>
parents: 22394
diff changeset
129 }
21647
ae601ad0b023 Truffle/Source: add some tests for SourceSections, including a reported design issue with empty Soruces.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
130 }