Workaround in ByteStringSpec for Scala-2.9 iterator.span bug

This commit is contained in:
Oliver Schulz 2012-05-27 01:12:45 +02:00
parent 7a854a9a83
commit ff57958688

View file

@ -183,7 +183,12 @@ class ByteStringSpec extends WordSpec with MustMatchers with Checkers {
"calling hasNext" in { check { a: ByteString likeVecIt(a) { _.hasNext } } }
"calling length" in { check { a: ByteString likeVecIt(a) { _.length } } }
"calling duplicate" in { check { a: ByteString likeVecIt(a)({ _.duplicate match { case (a, b) (a.toSeq, b.toSeq) } }, strict = false) } }
"calling span" in { check { (a: ByteString, b: Byte) likeVecIt(a)({ _.span(_ == b) match { case (a, b) (a.toSeq, b.toSeq) } }, strict = false) } }
// Have to used toList instead of toSeq here, iterator.span (new in
// Scala-2.9) seems to be broken in combination with toSeq for the
// scala.collection default Iterator (see Scala issue SI-5838).
"calling span" in { check { (a: ByteString, b: Byte) likeVecIt(a)({ _.span(_ == b) match { case (a, b) (a.toList, b.toList) } }, strict = false) } }
"calling takeWhile" in { check { (a: ByteString, b: Byte) likeVecIt(a)({ _.takeWhile(_ == b).toSeq }, strict = false) } }
"calling dropWhile" in { check { (a: ByteString, b: Byte) likeVecIt(a) { _.dropWhile(_ == b).toSeq } } }
"calling indexWhere" in { check { (a: ByteString, b: Byte) likeVecIt(a) { _.indexWhere(_ == b) } } }