summaryrefslogtreecommitdiff
path: root/test/files/scalacheck/si4147.scala
diff options
context:
space:
mode:
authorSimon Ochsenreither <simon@ochsenreither.de>2013-06-21 18:31:11 +0200
committerSimon Ochsenreither <simon@ochsenreither.de>2013-06-25 02:23:52 +0200
commitc0052870674b2f0c0310d4dbb0927023285e63c0 (patch)
treef6f2ff0b1680b326094f9dfb27f2381b67a3bd9f /test/files/scalacheck/si4147.scala
parent2a17db002758379fe0b9ee2a4e41ac9e3ca6c30d (diff)
downloadscala-c0052870674b2f0c0310d4dbb0927023285e63c0.tar.gz
scala-c0052870674b2f0c0310d4dbb0927023285e63c0.tar.bz2
scala-c0052870674b2f0c0310d4dbb0927023285e63c0.zip
SI-7590 TreeSet should fail fast if Ordering is null
While migrating scala.tools.nsc.util.TreeSet to scala.collection.mutable.TreeSet, I messed up initialization order and realized that TreeSet accepts null as an Ordering and only fails much later. This change makes mutable.TreeSet and immutable.TreeSet fail immediately.
Diffstat (limited to 'test/files/scalacheck/si4147.scala')
-rw-r--r--test/files/scalacheck/si4147.scala5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/files/scalacheck/si4147.scala b/test/files/scalacheck/si4147.scala
index 1453440ef1..05507b1b18 100644
--- a/test/files/scalacheck/si4147.scala
+++ b/test/files/scalacheck/si4147.scala
@@ -1,4 +1,4 @@
-import org.scalacheck.Prop.forAll
+import org.scalacheck.Prop.{forAll, throws}
import org.scalacheck.Properties
import org.scalacheck.ConsoleReporter.testStatsEx
import org.scalacheck.Gen
@@ -64,4 +64,7 @@ object Test extends Properties("Mutable TreeSet") {
view.filter(_ < 50) == Set[Int]() && view.filter(_ >= 150) == Set[Int]()
}
}
+
+ property("ordering must not be null") =
+ throws(mutable.TreeSet.empty[Int](null), classOf[NullPointerException])
}