changeset 22395:7a147c6abace

SourceSection: add position/length out of range tests
author Andreas Woess <andreas.woess@oracle.com>
date Thu, 19 Nov 2015 15:59:41 +0100
parents f56fa795a5a5
children 78f014d57b4b
files truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/source/SourceSectionTest.java
diffstat 1 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/source/SourceSectionTest.java	Thu Nov 19 15:58:26 2015 +0100
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/source/SourceSectionTest.java	Thu Nov 19 15:59:41 2015 +0100
@@ -97,4 +97,34 @@
         assertEquals("long:2", longSource.createSection("test", 6, 2).getShortDescription());
         assertEquals("long:3", longSource.createSection("test", 9, 1).getShortDescription());
     }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testOutOfRange1() {
+        longSource.createSection("test", 9, 5);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testOutOfRange2() {
+        longSource.createSection("test", -1, 1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testOutOfRange3() {
+        longSource.createSection("test", 1, -1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testOutOfRange4() {
+        longSource.createSection("test", 3, 1, 9, 5);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testOutOfRange5() {
+        longSource.createSection("test", 1, 1, -1, 1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testOutOfRange6() {
+        longSource.createSection("test", 1, 1, 1, -1);
+    }
 }