Skip to content

Commit

Permalink
Test cases closes SI-4574.
Browse files Browse the repository at this point in the history
Looks like I got that irrefutability bug too.
  • Loading branch information
paulp committed Mar 20, 2012
1 parent 032b209 commit fb44bb2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/files/run/t4574.check
@@ -0,0 +1,2 @@
I hereby refute null!
I denounce null as unListLike!
13 changes: 13 additions & 0 deletions test/files/run/t4574.scala
@@ -0,0 +1,13 @@
object Test {
val xs: List[(Int, Int)] = List((2, 2), null)

def expectMatchError[T](msg: String)(body: => T) {
try { body ; assert(false, "Should not succeed.") }
catch { case _: MatchError => println(msg) }
}

def main(args: Array[String]): Unit = {
expectMatchError("I hereby refute null!")( for ((x, y) <- xs) yield x )
expectMatchError("I denounce null as unListLike!")( (null: Any) match { case List(_*) => true } )
}
}

0 comments on commit fb44bb2

Please sign in to comment.