# HG changeset patch # User Andreas Woess # Date 1447945181 -3600 # Node ID 7a147c6abace40feb1452a3c6a464486e001a6ac # Parent f56fa795a5a53c6366cab6f5e45a2ea2aac88cc2 SourceSection: add position/length out of range tests diff -r f56fa795a5a5 -r 7a147c6abace truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/source/SourceSectionTest.java --- 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); + } }