diff options
author | stepancheg <stepancheg@epfl.ch> | 2008-05-24 15:01:02 +0000 |
---|---|---|
committer | stepancheg <stepancheg@epfl.ch> | 2008-05-24 15:01:02 +0000 |
commit | f6056a24c5a276cd8b763992f56e122f4ddbf76d (patch) | |
tree | e744d8d3548f5b7f4f5c5e0c88c15a16e02538f8 /test/files | |
parent | ad451f4a55ad9cd3683ee571a9b4697ddb4d1bfa (diff) | |
download | scala-f6056a24c5a276cd8b763992f56e122f4ddbf76d.tar.gz scala-f6056a24c5a276cd8b763992f56e122f4ddbf76d.tar.bz2 scala-f6056a24c5a276cd8b763992f56e122f4ddbf76d.zip |
Implement #886: indexOf, findIndexOf
introduces Iterator indexOf, findIndexOf
moved indexOf, findIndexOf bodies from Iterable to Iterator
deprecated Iterable indexOf, findIndexOf
introdued Seq indexOf, findIndexOf
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/iterators.check | 2 | ||||
-rw-r--r-- | test/files/run/iterators.scala | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/test/files/run/iterators.check b/test/files/run/iterators.check index 03e648876f..399324347f 100644 --- a/test/files/run/iterators.check +++ b/test/files/run/iterators.check @@ -7,4 +7,6 @@ test check_drop was successful test check_foreach was successful test check_forall was successful test check_fromArray was successful +test check_indexOf was successful +test check_findIndexOf was successful diff --git a/test/files/run/iterators.scala b/test/files/run/iterators.scala index a002ffadf0..9c427521df 100644 --- a/test/files/run/iterators.scala +++ b/test/files/run/iterators.scala @@ -84,6 +84,18 @@ object Test { xs0.length + xs1.length + xs2.length + xs3.length + xs4.length } + def check_indexOf: String = { + val i = List(1, 2, 3, 4, 5).indexOf(4) + val j = List(1, 2, 3, 4, 5).indexOf(16) + "" + i + "x" + j + } + + def check_findIndexOf: String = { + val i = List(1, 2, 3, 4, 5).findIndexOf { x: Int => x >= 4 } + val j = List(1, 2, 3, 4, 5).findIndexOf { x: Int => x >= 16 } + "" + i + "x" + j + } + def check_success[A](name: String, closure: => A, expected: A) { print("test " + name) try { @@ -110,6 +122,8 @@ object Test { check_success("check_foreach", check_foreach, 190) check_success("check_forall", check_forall, 0) check_success("check_fromArray",check_fromArray, 14) + check_success("check_indexOf", check_indexOf, "3x-1") + check_success("check_findIndexOf", check_findIndexOf, "3x-1") println() } } |