summaryrefslogtreecommitdiff
path: root/test/junit/scala/collection/LinearSeqOptimizedTest.scala
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2016-12-30 11:33:48 -0800
committerSom Snytt <som.snytt@gmail.com>2016-12-30 11:33:48 -0800
commita75e4a7fafef9ce619a8d0f0622333d20502e7c8 (patch)
tree2896ba23de22ff2bbd56c91762ebeca5ca8887b2 /test/junit/scala/collection/LinearSeqOptimizedTest.scala
parentbf9b00ebede9ab16fc4662a3dd5f5fb5d6a5ab7c (diff)
downloadscala-a75e4a7fafef9ce619a8d0f0622333d20502e7c8.tar.gz
scala-a75e4a7fafef9ce619a8d0f0622333d20502e7c8.tar.bz2
scala-a75e4a7fafef9ce619a8d0f0622333d20502e7c8.zip
SI-9936 LinearSeqOptimized.indexWhere
Also suffered from the negative `from` bug. Prefer `math.max` to avoid `RichInt`.
Diffstat (limited to 'test/junit/scala/collection/LinearSeqOptimizedTest.scala')
-rw-r--r--test/junit/scala/collection/LinearSeqOptimizedTest.scala19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/junit/scala/collection/LinearSeqOptimizedTest.scala b/test/junit/scala/collection/LinearSeqOptimizedTest.scala
new file mode 100644
index 0000000000..b9c34ed17c
--- /dev/null
+++ b/test/junit/scala/collection/LinearSeqOptimizedTest.scala
@@ -0,0 +1,19 @@
+package scala.collection
+
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import org.junit.Assert._
+import org.junit.Test
+
+@RunWith(classOf[JUnit4])
+class LinearSeqOptimizedTest {
+
+ @Test def `SI-9936 indexWhere`(): Unit = {
+ assertEquals(2, "abcde".indexOf('c', -1))
+ assertEquals(2, "abcde".indexOf('c', -2))
+ assertEquals(2, "abcde".toList.indexOf('c', -1))
+ assertEquals(2, "abcde".toList.indexOf('c', -2))
+ assertEquals(2, "abcde".toList.indexWhere(_ == 'c', -1))
+ assertEquals(2, "abcde".toList.indexWhere(_ == 'c', -2))
+ }
+}