You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2022/08/21 10:15:06 UTC
[groovy] branch master updated: additional testcase
This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new 7f6fcb2f81 additional testcase
7f6fcb2f81 is described below
commit 7f6fcb2f81b58a54bc7beef33ac382cb50a79cb4
Author: Paul King <pa...@asert.com.au>
AuthorDate: Sun Aug 21 20:14:56 2022 +1000
additional testcase
---
src/test/groovy/lang/IntRangeTest.groovy | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/test/groovy/lang/IntRangeTest.groovy b/src/test/groovy/lang/IntRangeTest.groovy
index 267180ed29..e1893e4979 100644
--- a/src/test/groovy/lang/IntRangeTest.groovy
+++ b/src/test/groovy/lang/IntRangeTest.groovy
@@ -62,6 +62,18 @@ final class IntRangeTest extends GroovyTestCase {
assert new IntRange(false, false, 0, 1).size() == 0
}
+ void testSubListBorders() {
+ // reminder: RangeInfo stores "to+1" for direct use in places like List#subList and CharSequence#subSequence
+ new IntRange(true, true, 1, 5).subListBorders(-1).with{ assert it.from == 1 && it.to == 6 && !it.reverse }
+ new IntRange(false, true, 1, 5).subListBorders(-1).with{ assert it.from == 2 && it.to == 6 && !it.reverse }
+ new IntRange(true, false, 1, 5).subListBorders(-1).with{ assert it.from == 1 && it.to == 5 && !it.reverse }
+ new IntRange(false, false, 1, 5).subListBorders(-1).with{ assert it.from == 2 && it.to == 5 && !it.reverse }
+ new IntRange(true, true, 5, 1).subListBorders(-1).with{ assert it.from == 1 && it.to == 6 && it.reverse }
+ new IntRange(false, true, 5, 1).subListBorders(-1).with{ assert it.from == 1 && it.to == 5 && it.reverse }
+ new IntRange(true, false, 5, 1).subListBorders(-1).with{ assert it.from == 2 && it.to == 6 && it.reverse }
+ new IntRange(false, false, 5, 1).subListBorders(-1).with{ assert it.from == 2 && it.to == 5 && it.reverse }
+ }
+
/**
* Tests getting the to and from values as <code>int</code>s.
*/