summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/files/jvm/unittest_io_Jvm.scala (renamed from test/files/jvm/unittest_io.scala)0
-rw-r--r--test/files/pos/bug0325.scala4
-rw-r--r--test/files/pos/bug1909b-pos.scala (renamed from test/files/pos/bug1909b.scala)0
-rw-r--r--test/files/pos/bug284-pos.scala (renamed from test/files/pos/bug284.scala)0
-rw-r--r--test/files/pos/bug3175-pos.scala (renamed from test/files/pos/bug3175.scala)0
-rw-r--r--test/files/pos/bug3636.scala (renamed from test/pending/pos/t3636.scala)0
-rw-r--r--test/files/pos/cyclics-pos.scala (renamed from test/files/pos/cyclics.scala)0
-rw-r--r--test/files/pos/depmet_1_pos.flags (renamed from test/files/pos/depmet_1.flags)0
-rw-r--r--test/files/pos/depmet_1_pos.scala (renamed from test/files/pos/depmet_1.scala)0
-rw-r--r--test/files/pos/imp2-pos.scala (renamed from test/files/pos/imp2.scala)0
-rw-r--r--test/files/pos/imports-pos.scala (renamed from test/files/pos/imports.scala)0
-rw-r--r--test/files/pos/infer2-pos.scala (renamed from test/files/pos/infer2.scala)0
-rw-r--r--test/files/pos/misc-unapply_pos.scala (renamed from test/files/pos/unapply.scala)0
-rw-r--r--test/files/pos/pos-bug1210.scala (renamed from test/files/pos/bug1210.scala)0
-rw-r--r--test/files/pos/pos-bug1241.scala (renamed from test/files/pos/bug1241.scala)0
-rw-r--r--test/files/pos/simple-exceptions.scala (renamed from test/files/pos/exceptions.scala)0
-rw-r--r--test/files/pos/t1422_pos.scala (renamed from test/files/pos/t1422.scala)0
-rw-r--r--test/files/pos/t1591_pos.scala (renamed from test/files/pos/t1591.scala)0
-rw-r--r--test/files/pos/t2208_pos.scala (renamed from test/files/pos/t2208.scala)0
-rw-r--r--test/files/pos/t2421b_pos.scala (renamed from test/files/pos/t2421b.scala)0
-rw-r--r--test/files/pos/t2726/bug2726_2.scala (renamed from test/files/pos/t2726/test_2.scala)0
-rw-r--r--test/files/pos/t2868/t2868_src_2.scala (renamed from test/files/pos/t2868/test_2.scala)0
-rw-r--r--test/files/pos/tcpoly_variance_pos.scala (renamed from test/files/pos/tcpoly_variance.scala)0
-rw-r--r--test/files/pos/test2.scala5
-rw-r--r--test/files/pos/typerep_pos.scala (renamed from test/files/pos/typerep.scala)0
-rw-r--r--test/files/pos/variances_pos.scala (renamed from test/files/pos/variances.scala)0
-rw-r--r--test/files/run/bug3150.scala (renamed from test/pending/run/bug3150.scala)0
-rw-r--r--test/files/run/lazy-override-run.check (renamed from test/files/run/lazy-override.check)0
-rw-r--r--test/files/run/lazy-override-run.scala (renamed from test/files/run/lazy-override.scala)0
-rw-r--r--test/files/run/lists-run.scala (renamed from test/files/run/lists.scala)0
-rw-r--r--test/files/run/t2316_run.scala (renamed from test/files/run/t2316.scala)0
-rw-r--r--test/files/scalacheck/CheckEither.scala194
-rw-r--r--test/files/scalacheck/array.scala (renamed from test/pending/scalacheck/array.scala)0
-rw-r--r--test/files/scalacheck/list.scala (renamed from test/pending/scalacheck/list.scala)0
-rw-r--r--test/files/scalacheck/primitive-eqeq.scala (renamed from test/pending/scalacheck/eqeq.scala)0
-rw-r--r--test/files/scalacheck/range.scala (renamed from test/pending/scalacheck/range.scala)9
-rw-r--r--test/files/scalacheck/scan.scala (renamed from test/pending/scalacheck/scan.scala)0
-rw-r--r--test/files/scalacheck/substringTests.scala (renamed from test/files/scalacheck/test2.scala)0
-rw-r--r--test/partest-tests/jvm/actor-receivewithin.check16
-rw-r--r--test/partest-tests/jvm/actor-receivewithin.scala69
-rw-r--r--test/partest-tests/run/crash.scala6
-rw-r--r--test/partest-tests/run/streamWithFilter.check5
-rw-r--r--test/partest-tests/run/streamWithFilter.scala11
-rw-r--r--test/partest-tests/run/timeout.scala5
-rw-r--r--test/pending/neg/t1477.scala25
-rw-r--r--test/pending/pos/bug2018.scala15
-rw-r--r--test/pending/pos/bug3420.flags1
-rw-r--r--test/pending/pos/bug3420.scala5
-rw-r--r--test/pending/pos/bug563.scala7
-rw-r--r--test/pending/pos/foo.scala3
-rw-r--r--test/pending/pos/t0716.scala24
-rw-r--r--test/pending/pos/t2162.scala20
-rw-r--r--test/pending/pos/t2179.scala6
-rw-r--r--test/pending/pos/t2635.scala16
-rw-r--r--test/pending/pos/t2641.scala16
-rw-r--r--test/pending/run/bug1006.scala13
-rw-r--r--test/pending/run/bug2087.scala8
-rw-r--r--test/pending/run/bug2365/Test.scala35
-rw-r--r--test/pending/run/bug2365/bug2365.javaopts1
-rw-r--r--test/pending/run/castsingleton.scala10
-rw-r--r--test/pending/run/t0807.scala5
-rw-r--r--test/pending/run/t1939.scala41
-rw-r--r--test/pending/scalacheck/CheckEither.scala253
-rwxr-xr-xtest/pending/script/bug2365.sh (renamed from test/pending/run/bug2365/run)0
-rw-r--r--test/pending/script/error-messages.check (renamed from test/pending/script/errors.check)0
-rw-r--r--test/pending/script/error-messages.scala (renamed from test/pending/script/errors.scala)0
66 files changed, 199 insertions, 629 deletions
diff --git a/test/files/jvm/unittest_io.scala b/test/files/jvm/unittest_io_Jvm.scala
index fd5889cb86..fd5889cb86 100644
--- a/test/files/jvm/unittest_io.scala
+++ b/test/files/jvm/unittest_io_Jvm.scala
diff --git a/test/files/pos/bug0325.scala b/test/files/pos/bug0325.scala
deleted file mode 100644
index 4b13c431b7..0000000000
--- a/test/files/pos/bug0325.scala
+++ /dev/null
@@ -1,4 +0,0 @@
-class Foobar {
- val foo = "foo";
- def foo(bar: String): String = foo + bar; // crashes the compiler
-}
diff --git a/test/files/pos/bug1909b.scala b/test/files/pos/bug1909b-pos.scala
index b914bee366..b914bee366 100644
--- a/test/files/pos/bug1909b.scala
+++ b/test/files/pos/bug1909b-pos.scala
diff --git a/test/files/pos/bug284.scala b/test/files/pos/bug284-pos.scala
index 19673b7e4c..19673b7e4c 100644
--- a/test/files/pos/bug284.scala
+++ b/test/files/pos/bug284-pos.scala
diff --git a/test/files/pos/bug3175.scala b/test/files/pos/bug3175-pos.scala
index 89bbf8b5fc..89bbf8b5fc 100644
--- a/test/files/pos/bug3175.scala
+++ b/test/files/pos/bug3175-pos.scala
diff --git a/test/pending/pos/t3636.scala b/test/files/pos/bug3636.scala
index 24d18c653d..24d18c653d 100644
--- a/test/pending/pos/t3636.scala
+++ b/test/files/pos/bug3636.scala
diff --git a/test/files/pos/cyclics.scala b/test/files/pos/cyclics-pos.scala
index 395e88815a..395e88815a 100644
--- a/test/files/pos/cyclics.scala
+++ b/test/files/pos/cyclics-pos.scala
diff --git a/test/files/pos/depmet_1.flags b/test/files/pos/depmet_1_pos.flags
index 1c26b24745..1c26b24745 100644
--- a/test/files/pos/depmet_1.flags
+++ b/test/files/pos/depmet_1_pos.flags
diff --git a/test/files/pos/depmet_1.scala b/test/files/pos/depmet_1_pos.scala
index 166e991817..166e991817 100644
--- a/test/files/pos/depmet_1.scala
+++ b/test/files/pos/depmet_1_pos.scala
diff --git a/test/files/pos/imp2.scala b/test/files/pos/imp2-pos.scala
index 5460c60015..5460c60015 100644
--- a/test/files/pos/imp2.scala
+++ b/test/files/pos/imp2-pos.scala
diff --git a/test/files/pos/imports.scala b/test/files/pos/imports-pos.scala
index f6a55e5e07..f6a55e5e07 100644
--- a/test/files/pos/imports.scala
+++ b/test/files/pos/imports-pos.scala
diff --git a/test/files/pos/infer2.scala b/test/files/pos/infer2-pos.scala
index e065219a80..e065219a80 100644
--- a/test/files/pos/infer2.scala
+++ b/test/files/pos/infer2-pos.scala
diff --git a/test/files/pos/unapply.scala b/test/files/pos/misc-unapply_pos.scala
index 6651e64362..6651e64362 100644
--- a/test/files/pos/unapply.scala
+++ b/test/files/pos/misc-unapply_pos.scala
diff --git a/test/files/pos/bug1210.scala b/test/files/pos/pos-bug1210.scala
index eb163a956e..eb163a956e 100644
--- a/test/files/pos/bug1210.scala
+++ b/test/files/pos/pos-bug1210.scala
diff --git a/test/files/pos/bug1241.scala b/test/files/pos/pos-bug1241.scala
index 333e6c5490..333e6c5490 100644
--- a/test/files/pos/bug1241.scala
+++ b/test/files/pos/pos-bug1241.scala
diff --git a/test/files/pos/exceptions.scala b/test/files/pos/simple-exceptions.scala
index 52c33fb43a..52c33fb43a 100644
--- a/test/files/pos/exceptions.scala
+++ b/test/files/pos/simple-exceptions.scala
diff --git a/test/files/pos/t1422.scala b/test/files/pos/t1422_pos.scala
index 658f5c730d..658f5c730d 100644
--- a/test/files/pos/t1422.scala
+++ b/test/files/pos/t1422_pos.scala
diff --git a/test/files/pos/t1591.scala b/test/files/pos/t1591_pos.scala
index 4f55d7ce19..4f55d7ce19 100644
--- a/test/files/pos/t1591.scala
+++ b/test/files/pos/t1591_pos.scala
diff --git a/test/files/pos/t2208.scala b/test/files/pos/t2208_pos.scala
index f1a521b14c..f1a521b14c 100644
--- a/test/files/pos/t2208.scala
+++ b/test/files/pos/t2208_pos.scala
diff --git a/test/files/pos/t2421b.scala b/test/files/pos/t2421b_pos.scala
index 0df3461662..0df3461662 100644
--- a/test/files/pos/t2421b.scala
+++ b/test/files/pos/t2421b_pos.scala
diff --git a/test/files/pos/t2726/test_2.scala b/test/files/pos/t2726/bug2726_2.scala
index e738143aeb..e738143aeb 100644
--- a/test/files/pos/t2726/test_2.scala
+++ b/test/files/pos/t2726/bug2726_2.scala
diff --git a/test/files/pos/t2868/test_2.scala b/test/files/pos/t2868/t2868_src_2.scala
index f11ef0fae2..f11ef0fae2 100644
--- a/test/files/pos/t2868/test_2.scala
+++ b/test/files/pos/t2868/t2868_src_2.scala
diff --git a/test/files/pos/tcpoly_variance.scala b/test/files/pos/tcpoly_variance_pos.scala
index b641716d50..b641716d50 100644
--- a/test/files/pos/tcpoly_variance.scala
+++ b/test/files/pos/tcpoly_variance_pos.scala
diff --git a/test/files/pos/test2.scala b/test/files/pos/test2.scala
deleted file mode 100644
index 0dcc16ffab..0000000000
--- a/test/files/pos/test2.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-import scala._;
-object test2 {
- def f(x: Int): Int = 'a';
- def g(x: Int) = f(f(x));
-}
diff --git a/test/files/pos/typerep.scala b/test/files/pos/typerep_pos.scala
index 7faa8a1928..7faa8a1928 100644
--- a/test/files/pos/typerep.scala
+++ b/test/files/pos/typerep_pos.scala
diff --git a/test/files/pos/variances.scala b/test/files/pos/variances_pos.scala
index 7dc56b0225..7dc56b0225 100644
--- a/test/files/pos/variances.scala
+++ b/test/files/pos/variances_pos.scala
diff --git a/test/pending/run/bug3150.scala b/test/files/run/bug3150.scala
index 034703b5f7..034703b5f7 100644
--- a/test/pending/run/bug3150.scala
+++ b/test/files/run/bug3150.scala
diff --git a/test/files/run/lazy-override.check b/test/files/run/lazy-override-run.check
index a8f658d7b5..a8f658d7b5 100644
--- a/test/files/run/lazy-override.check
+++ b/test/files/run/lazy-override-run.check
diff --git a/test/files/run/lazy-override.scala b/test/files/run/lazy-override-run.scala
index e5884257a8..e5884257a8 100644
--- a/test/files/run/lazy-override.scala
+++ b/test/files/run/lazy-override-run.scala
diff --git a/test/files/run/lists.scala b/test/files/run/lists-run.scala
index 6c9b55961e..6c9b55961e 100644
--- a/test/files/run/lists.scala
+++ b/test/files/run/lists-run.scala
diff --git a/test/files/run/t2316.scala b/test/files/run/t2316_run.scala
index a3d5bf890b..a3d5bf890b 100644
--- a/test/files/run/t2316.scala
+++ b/test/files/run/t2316_run.scala
diff --git a/test/files/scalacheck/CheckEither.scala b/test/files/scalacheck/CheckEither.scala
new file mode 100644
index 0000000000..0651b90b2e
--- /dev/null
+++ b/test/files/scalacheck/CheckEither.scala
@@ -0,0 +1,194 @@
+import org.scalacheck.{ Arbitrary, ConsoleReporter, Prop, Properties }
+import org.scalacheck.Arbitrary.{arbitrary, arbThrowable}
+import org.scalacheck.Gen.oneOf
+import org.scalacheck.util.StdRand
+import org.scalacheck.Prop._
+import org.scalacheck.ConsoleReporter.{testReport, propReport}
+import org.scalacheck.Test.{Params, check}
+import org.scalacheck.ConsoleReporter.testStatsEx
+import Function.tupled
+
+object CheckEither extends Properties("Either") {
+ implicit def arbitraryEither[X, Y](implicit xa: Arbitrary[X], ya: Arbitrary[Y]): Arbitrary[Either[X, Y]] =
+ Arbitrary[Either[X, Y]](oneOf(arbitrary[X].map(Left(_)), arbitrary[Y].map(Right(_))))
+
+ val prop_either1 = forAll((n: Int) => Left(n).fold(x => x, b => error("fail")) == n)
+
+ val prop_either2 = forAll((n: Int) => Right(n).fold(a => error("fail"), x => x) == n)
+
+ val prop_swap = forAll((e: Either[Int, Int]) => e match {
+ case Left(a) => e.swap.right.get == a
+ case Right(b) => e.swap.left.get == b
+ })
+
+ val prop_isLeftRight = forAll((e: Either[Int, Int]) => e.isLeft != e.isRight)
+
+ object CheckLeftProjection {
+ val prop_value = forAll((n: Int) => Left(n).left.get == n)
+
+ val prop_getOrElse = forAll((e: Either[Int, Int], or: Int) => e.left.getOrElse(or) == (e match {
+ case Left(a) => a
+ case Right(_) => or
+ }))
+
+ val prop_forall = forAll((e: Either[Int, Int]) =>
+ e.left.forall(_ % 2 == 0) == (e.isRight || e.left.get % 2 == 0))
+
+ val prop_exists = forAll((e: Either[Int, Int]) =>
+ e.left.exists(_ % 2 == 0) == (e.isLeft && e.left.get % 2 == 0))
+
+ val prop_flatMapLeftIdentity = forAll((e: Either[Int, Int], n: Int, s: String) => {
+ def f(x: Int) = if(x % 2 == 0) Left(s) else Right(s)
+ Left(n).left.flatMap(f(_)) == f(n)})
+
+ val prop_flatMapRightIdentity = forAll((e: Either[Int, Int]) => e.left.flatMap(Left(_)) == e)
+
+ val prop_flatMapComposition = forAll((e: Either[Int, Int]) => {
+ def f(x: Int) = if(x % 2 == 0) Left(x) else Right(x)
+ def g(x: Int) = if(x % 7 == 0) Right(x) else Left(x)
+ e.left.flatMap(f(_)).left.flatMap(g(_)) == e.left.flatMap(f(_).left.flatMap(g(_)))})
+
+ val prop_mapIdentity = forAll((e: Either[Int, Int]) => e.left.map(x => x) == e)
+
+ val prop_mapComposition = forAll((e: Either[String, Int]) => {
+ def f(s: String) = s.toLowerCase
+ def g(s: String) = s.reverse
+ e.left.map(x => f(g(x))) == e.left.map(x => g(x)).left.map(f(_))})
+
+ val prop_filter = forAll((e: Either[Int, Int], x: Int) => e.left.filter(_ % 2 == 0) ==
+ (if(e.isRight || e.left.get % 2 != 0) None else Some(e)))
+
+ val prop_seq = forAll((e: Either[Int, Int]) => e.left.toSeq == (e match {
+ case Left(a) => Seq(a)
+ case Right(_) => Seq.empty
+ }))
+
+ val prop_option = forAll((e: Either[Int, Int]) => e.left.toOption == (e match {
+ case Left(a) => Some(a)
+ case Right(_) => None
+ }))
+ }
+
+ object CheckRightProjection {
+ val prop_value = forAll((n: Int) => Right(n).right.get == n)
+
+ val prop_getOrElse = forAll((e: Either[Int, Int], or: Int) => e.right.getOrElse(or) == (e match {
+ case Left(_) => or
+ case Right(b) => b
+ }))
+
+ val prop_forall = forAll((e: Either[Int, Int]) =>
+ e.right.forall(_ % 2 == 0) == (e.isLeft || e.right.get % 2 == 0))
+
+ val prop_exists = forAll((e: Either[Int, Int]) =>
+ e.right.exists(_ % 2 == 0) == (e.isRight && e.right.get % 2 == 0))
+
+ val prop_flatMapLeftIdentity = forAll((e: Either[Int, Int], n: Int, s: String) => {
+ def f(x: Int) = if(x % 2 == 0) Left(s) else Right(s)
+ Right(n).right.flatMap(f(_)) == f(n)})
+
+ val prop_flatMapRightIdentity = forAll((e: Either[Int, Int]) => e.right.flatMap(Right(_)) == e)
+
+ val prop_flatMapComposition = forAll((e: Either[Int, Int]) => {
+ def f(x: Int) = if(x % 2 == 0) Left(x) else Right(x)
+ def g(x: Int) = if(x % 7 == 0) Right(x) else Left(x)
+ e.right.flatMap(f(_)).right.flatMap(g(_)) == e.right.flatMap(f(_).right.flatMap(g(_)))})
+
+ val prop_mapIdentity = forAll((e: Either[Int, Int]) => e.right.map(x => x) == e)
+
+ val prop_mapComposition = forAll((e: Either[Int, String]) => {
+ def f(s: String) = s.toLowerCase
+ def g(s: String) = s.reverse
+ e.right.map(x => f(g(x))) == e.right.map(x => g(x)).right.map(f(_))})
+
+ val prop_filter = forAll((e: Either[Int, Int], x: Int) => e.right.filter(_ % 2 == 0) ==
+ (if(e.isLeft || e.right.get % 2 != 0) None else Some(e)))
+
+ val prop_seq = forAll((e: Either[Int, Int]) => e.right.toSeq == (e match {
+ case Left(_) => Seq.empty
+ case Right(b) => Seq(b)
+ }))
+
+ val prop_option = forAll((e: Either[Int, Int]) => e.right.toOption == (e match {
+ case Left(_) => None
+ case Right(b) => Some(b)
+ }))
+ }
+
+ val prop_Either_left = forAll((n: Int) => Left(n).left.get == n)
+
+ val prop_Either_right = forAll((n: Int) => Right(n).right.get == n)
+
+ val prop_Either_joinLeft = forAll((e: Either[Either[Int, Int], Int]) => e match {
+ case Left(ee) => e.joinLeft == ee
+ case Right(n) => e.joinLeft == Right(n)
+ })
+
+ val prop_Either_joinRight = forAll((e: Either[Int, Either[Int, Int]]) => e match {
+ case Left(n) => e.joinRight == Left(n)
+ case Right(ee) => e.joinRight == ee
+ })
+
+ val prop_Either_reduce = forAll((e: Either[Int, Int]) =>
+ e.merge == (e match {
+ case Left(a) => a
+ case Right(a) => a
+ }))
+
+ /** Hard to believe I'm "fixing" a test to reflect B before A ... */
+ val prop_Either_cond = forAll((c: Boolean, a: Int, b: Int) =>
+ Either.cond(c, a, b) == (if(c) Right(a) else Left(b)))
+
+ val tests = List(
+ ("prop_either1", prop_either1),
+ ("prop_either2", prop_either2),
+ ("prop_swap", prop_swap),
+ ("prop_isLeftRight", prop_isLeftRight),
+ ("Left.prop_value", CheckLeftProjection.prop_value),
+ ("Left.prop_getOrElse", CheckLeftProjection.prop_getOrElse),
+ ("Left.prop_forall", CheckLeftProjection.prop_forall),
+ ("Left.prop_exists", CheckLeftProjection.prop_exists),
+ ("Left.prop_flatMapLeftIdentity", CheckLeftProjection.prop_flatMapLeftIdentity),
+ ("Left.prop_flatMapRightIdentity", CheckLeftProjection.prop_flatMapRightIdentity),
+ ("Left.prop_flatMapComposition", CheckLeftProjection.prop_flatMapComposition),
+ ("Left.prop_mapIdentity", CheckLeftProjection.prop_mapIdentity),
+ ("Left.prop_mapComposition", CheckLeftProjection.prop_mapComposition),
+ ("Left.prop_filter", CheckLeftProjection.prop_filter),
+ ("Left.prop_seq", CheckLeftProjection.prop_seq),
+ ("Left.prop_option", CheckLeftProjection.prop_option),
+ ("Right.prop_value", CheckRightProjection.prop_value),
+ ("Right.prop_getOrElse", CheckRightProjection.prop_getOrElse),
+ ("Right.prop_forall", CheckRightProjection.prop_forall),
+ ("Right.prop_exists", CheckRightProjection.prop_exists),
+ ("Right.prop_flatMapLeftIdentity", CheckRightProjection.prop_flatMapLeftIdentity),
+ ("Right.prop_flatMapRightIdentity", CheckRightProjection.prop_flatMapRightIdentity),
+ ("Right.prop_flatMapComposition", CheckRightProjection.prop_flatMapComposition),
+ ("Right.prop_mapIdentity", CheckRightProjection.prop_mapIdentity),
+ ("Right.prop_mapComposition", CheckRightProjection.prop_mapComposition),
+ ("Right.prop_filter", CheckRightProjection.prop_filter),
+ ("Right.prop_seq", CheckRightProjection.prop_seq),
+ ("Right.prop_option", CheckRightProjection.prop_option),
+ ("prop_Either_left", prop_Either_left),
+ ("prop_Either_right", prop_Either_right),
+ ("prop_Either_joinLeft", prop_Either_joinLeft),
+ ("prop_Either_joinRight", prop_Either_joinRight),
+ ("prop_Either_reduce", prop_Either_reduce),
+ ("prop_Either_cond", prop_Either_cond)
+ )
+
+ for ((label, prop) <- tests) {
+ property(label) = prop
+ }
+
+ import org.scalacheck.{ Test => STest }
+
+ def runTests() = {
+ STest.checkProperties(STest.Params(testCallback = ConsoleReporter(0)), this)
+ }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ CheckEither.runTests()
+ }
+}
diff --git a/test/pending/scalacheck/array.scala b/test/files/scalacheck/array.scala
index 03c0217180..03c0217180 100644
--- a/test/pending/scalacheck/array.scala
+++ b/test/files/scalacheck/array.scala
diff --git a/test/pending/scalacheck/list.scala b/test/files/scalacheck/list.scala
index 1caf35e872..1caf35e872 100644
--- a/test/pending/scalacheck/list.scala
+++ b/test/files/scalacheck/list.scala
diff --git a/test/pending/scalacheck/eqeq.scala b/test/files/scalacheck/primitive-eqeq.scala
index 60fe63c207..60fe63c207 100644
--- a/test/pending/scalacheck/eqeq.scala
+++ b/test/files/scalacheck/primitive-eqeq.scala
diff --git a/test/pending/scalacheck/range.scala b/test/files/scalacheck/range.scala
index faa1f5d479..b14177e38b 100644
--- a/test/pending/scalacheck/range.scala
+++ b/test/files/scalacheck/range.scala
@@ -183,10 +183,11 @@ object SmallValuesRange extends RangeTest("smallValues") {
}
object Test extends Properties("Range") {
- include(NormalRangeTest)
- include(InclusiveRangeTest)
- include(ByOneRangeTest)
- include(InclusiveByOneRangeTest)
+ import org.scalacheck.{ Test => STest }
+
+ List(NormalRangeTest, InclusiveRangeTest, ByOneRangeTest, InclusiveByOneRangeTest) foreach { ps =>
+ STest.checkProperties(STest.Params(testCallback = ConsoleReporter(0)), ps)
+ }
}
/* Mini-benchmark
diff --git a/test/pending/scalacheck/scan.scala b/test/files/scalacheck/scan.scala
index e9b25ce3df..e9b25ce3df 100644
--- a/test/pending/scalacheck/scan.scala
+++ b/test/files/scalacheck/scan.scala
diff --git a/test/files/scalacheck/test2.scala b/test/files/scalacheck/substringTests.scala
index 2cb5fc0498..2cb5fc0498 100644
--- a/test/files/scalacheck/test2.scala
+++ b/test/files/scalacheck/substringTests.scala
diff --git a/test/partest-tests/jvm/actor-receivewithin.check b/test/partest-tests/jvm/actor-receivewithin.check
deleted file mode 100644
index a6a3e88c61..0000000000
--- a/test/partest-tests/jvm/actor-receivewithin.check
+++ /dev/null
@@ -1,16 +0,0 @@
-'msg
-'msg
-'msg
-'msg
-'msg
-TIMEOUT
-TIMEOUT
-TIMEOUT
-TIMEOUT
-TIMEOUT
-'msg2
-'msg2
-'msg2
-'msg2
-'msg2
-TIMEOUT
diff --git a/test/partest-tests/jvm/actor-receivewithin.scala b/test/partest-tests/jvm/actor-receivewithin.scala
deleted file mode 100644
index a5c87c2722..0000000000
--- a/test/partest-tests/jvm/actor-receivewithin.scala
+++ /dev/null
@@ -1,69 +0,0 @@
-import scala.actors.{Actor, TIMEOUT}
-
-object A extends Actor {
- def act() {
- receive {
- case 'done =>
- var cnt = 0
- while (cnt < 500) {
- cnt += 1
- receiveWithin (0) {
- case 'msg =>
- if (cnt % 100 == 0)
- println("'msg")
- case TIMEOUT =>
- // should not happen
- println("FAIL1")
- }
- }
- cnt = 0
- while (cnt < 500) {
- cnt += 1
- receiveWithin (0) {
- case 'msg =>
- // should not happen
- println("FAIL2")
- case TIMEOUT =>
- if (cnt % 100 == 0)
- println("TIMEOUT")
- }
- }
- B ! 'next
- receive { case 'done => }
- cnt = 0
- while (cnt < 501) {
- cnt += 1
- receiveWithin (500) {
- case 'msg2 =>
- if (cnt % 100 == 0)
- println("'msg2")
- case TIMEOUT =>
- println("TIMEOUT")
- }
- }
- }
- }
-}
-
-object B extends Actor {
- def act() {
- A.start()
- for (_ <- 1 to 500) {
- A ! 'msg
- }
- A ! 'done
- receive {
- case 'next =>
- for (_ <- 1 to 500) {
- A ! 'msg2
- }
- A ! 'done
- }
- }
-}
-
-object Test {
- def main(args:Array[String]) {
- B.start()
- }
-}
diff --git a/test/partest-tests/run/crash.scala b/test/partest-tests/run/crash.scala
deleted file mode 100644
index 1735cc444e..0000000000
--- a/test/partest-tests/run/crash.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-object Test {
- def main(args: Array[String]): Unit = {
- val t = new Throwable("DOOM")
- throw t
- }
-}
diff --git a/test/partest-tests/run/streamWithFilter.check b/test/partest-tests/run/streamWithFilter.check
deleted file mode 100644
index 6b0e91a147..0000000000
--- a/test/partest-tests/run/streamWithFilter.check
+++ /dev/null
@@ -1,5 +0,0 @@
-15
-30
-45
-60
-75
diff --git a/test/partest-tests/run/streamWithFilter.scala b/test/partest-tests/run/streamWithFilter.scala
deleted file mode 100644
index cb919d4f55..0000000000
--- a/test/partest-tests/run/streamWithFilter.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-object Test {
- val nums = Stream.from(1)
- def isFizz(x: Int) = x % 3 == 0
- def isBuzz(x: Int) = x % 5 == 0
- // next line will run forever if withFilter isn't doing its thing.
- val fizzbuzzes = for (n <- nums ; if isFizz(n) ; if isBuzz(n)) yield n
-
- def main(args: Array[String]): Unit = {
- fizzbuzzes take 5 foreach println
- }
-}
diff --git a/test/partest-tests/run/timeout.scala b/test/partest-tests/run/timeout.scala
deleted file mode 100644
index 91417b39ab..0000000000
--- a/test/partest-tests/run/timeout.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-object Test {
- def main(args: Array[String]): Unit = {
- Thread.sleep(10000000)
- }
-}
diff --git a/test/pending/neg/t1477.scala b/test/pending/neg/t1477.scala
deleted file mode 100644
index 0cc0cd5f7a..0000000000
--- a/test/pending/neg/t1477.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-object Test extends Application {
- trait A
- trait B extends A
-
- trait C {
- type U
- trait D { type T >: B <: A }
- type V <: D
- val y: V#T = new B { }
- }
-
- trait Middle extends C {
- type V <: (D with U)
- }
-
- class D extends Middle {
- trait E
- trait F { type T = E }
- type U = F
- def frob(arg : E) : E = arg
- frob(y)
- }
-
- new D
-}
diff --git a/test/pending/pos/bug2018.scala b/test/pending/pos/bug2018.scala
deleted file mode 100644
index f1753f4d7a..0000000000
--- a/test/pending/pos/bug2018.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-class A {
- val b = new B
-
- def getChildren = List(new A).elements
-
- class B {
- private def check = true
-
- private def getAncestor(p: A): A = {
- val c = (p.getChildren.find(_.b.check)) match {case Some(d) => d case None => p}
-
- if (c == p) p else c.b.getAncestor(c)
- }
- }
-}
diff --git a/test/pending/pos/bug3420.flags b/test/pending/pos/bug3420.flags
deleted file mode 100644
index ea03113c66..0000000000
--- a/test/pending/pos/bug3420.flags
+++ /dev/null
@@ -1 +0,0 @@
--optimise -Xfatal-warnings \ No newline at end of file
diff --git a/test/pending/pos/bug3420.scala b/test/pending/pos/bug3420.scala
deleted file mode 100644
index 0fc56ed67b..0000000000
--- a/test/pending/pos/bug3420.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-class C {
- val cv = Map[Int, Int](1 -> 2)
- lazy val cl = Map[Int, Int](1 -> 2)
- def cd = Map[Int, Int](1 -> 2)
-}
diff --git a/test/pending/pos/bug563.scala b/test/pending/pos/bug563.scala
deleted file mode 100644
index d559226bdb..0000000000
--- a/test/pending/pos/bug563.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-object Test {
- def map[A,R](a : List[A], f : A => R) : List[R] = a.map(f);
-
- def split(sn : Iterable[List[Cell[int]]]) : unit =
- for (val n <- sn)
- map(n,ptr => new Cell(ptr.elem));
-}
diff --git a/test/pending/pos/foo.scala b/test/pending/pos/foo.scala
deleted file mode 100644
index 8b45addbd5..0000000000
--- a/test/pending/pos/foo.scala
+++ /dev/null
@@ -1,3 +0,0 @@
-object foo {
- var x: String
-}
diff --git a/test/pending/pos/t0716.scala b/test/pending/pos/t0716.scala
deleted file mode 100644
index 98ba9bb2aa..0000000000
--- a/test/pending/pos/t0716.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-trait Functor[F[_]] {
- def fmap[A,B](fun: A=>B, arg:F[A]): F[B]
-}
-object Functor{
- implicit val ListFunctor = new Functor[List] {
- def fmap[A, B](f: A => B, arg: List[A]):List[B] = arg map f
- }
-
- final class OOFunctor[F[_],A](arg:F[A])(implicit ftr: Functor[F]) {
- def fmap[B](fun: A=>B):F[B] = ftr.fmap(fun,arg)
- }
-
- //breaks if uncommented
- implicit def lifttoOO[F[_],A](arg:F[A])(implicit ftr: Functor[F]) = new OOFunctor[F,A](arg)(ftr)
-
- //works if uncommented
- //implicit def liftListtoOO[A](arg:List[A]):OOFunctor[List,A] = new OOFunctor[List,A](arg)
-}
-
-object GeneralLiftingDemo extends Application {
- import Functor._
- val l = List(1,2,3)
- println("OO : " + l.fmap( 1+) )
-}
diff --git a/test/pending/pos/t2162.scala b/test/pending/pos/t2162.scala
deleted file mode 100644
index b21404726b..0000000000
--- a/test/pending/pos/t2162.scala
+++ /dev/null
@@ -1,20 +0,0 @@
-// crash verified; no solution yet
-class Foo(x: Int)
-class Bar extends Foo(1)
-
-trait A {
- def foo[T <: Foo]
-}
-class B extends A {
- def foo[Bar] { println("B.foo[Bar]") }
-}
-object test {
- val x = new B
- val y = new A {
- def foo[Bar] { println("A.foo[Bar]") }
- }
- def main(args: Array[String]) {
- x.foo // ok
- y.foo // java.lang.AssertionError: assertion failed (Erasure.scala:441 in r18338))
- }
-}
diff --git a/test/pending/pos/t2179.scala b/test/pending/pos/t2179.scala
deleted file mode 100644
index fd37d8f760..0000000000
--- a/test/pending/pos/t2179.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-on trunk r18368, this delightful little poison pill:
-
-(Nil:List[List[Double]]).reduceLeft((_: Any, _: Any) => Nil.indices.map(_ => 0d))
-
-sends the compiler into an apparently infinite loop. a sample thread dump shows:
-
diff --git a/test/pending/pos/t2635.scala b/test/pending/pos/t2635.scala
deleted file mode 100644
index 378631b23d..0000000000
--- a/test/pending/pos/t2635.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-abstract class Base
-
-object Test
-{
- def run(c: Class[_ <: Base]): Unit = {
- }
-
- def main(args: Array[String]): Unit =
- {
- val sc: Option[Class[_ <: Base]] = Some(classOf[Base])
- sc match {
- case Some((c: Class[_ <: Base])) => run(c)
- case None =>
- }
- }
-} \ No newline at end of file
diff --git a/test/pending/pos/t2641.scala b/test/pending/pos/t2641.scala
deleted file mode 100644
index fec825c4f9..0000000000
--- a/test/pending/pos/t2641.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-import scala.collection._
-import scala.collection.generic._
-
-abstract class ManagedSeqStrict[+A]
- extends Traversable[A]
- with GenericTraversableTemplate[A, ManagedSeqStrict]
-
-trait ManagedSeq[+A, +Coll]
- extends ManagedSeqStrict[A]
- with TraversableView[A, ManagedSeqStrict[A]]
- with TraversableViewLike[A, ManagedSeqStrict[A], ManagedSeq[A/*ERROR: too few type args*/]]
-{ self =>
- trait Transformed[+B] extends ManagedSeq[B, Coll] with super.Transformed[B]
-
- trait Sliced extends Transformed[A] with super.Sliced
-} \ No newline at end of file
diff --git a/test/pending/run/bug1006.scala b/test/pending/run/bug1006.scala
deleted file mode 100644
index 0a82373fb6..0000000000
--- a/test/pending/run/bug1006.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-object foo {
- def main(args: Array[String]) {
- abstract class A[T] {
- def myVal: T
- }
-
- class B[T](value: T) extends A[T] {
- def myVal = value
- }
-
- Console.println(new B[int](23).myVal)
- }
-}
diff --git a/test/pending/run/bug2087.scala b/test/pending/run/bug2087.scala
deleted file mode 100644
index b3f96fa415..0000000000
--- a/test/pending/run/bug2087.scala
+++ /dev/null
@@ -1,8 +0,0 @@
-object Test {
- def main(args: Array[String]): Unit = {
- val s: Short = 0xFA99.toShort
- val c: Char = 0xFA99.toChar
-
- assert((s == c) == (c == s))
- }
-} \ No newline at end of file
diff --git a/test/pending/run/bug2365/Test.scala b/test/pending/run/bug2365/Test.scala
deleted file mode 100644
index 92b58f4a25..0000000000
--- a/test/pending/run/bug2365/Test.scala
+++ /dev/null
@@ -1,35 +0,0 @@
-import scala.tools.nsc.io._
-import java.net.URL
-
-object A { def apply(d: { def apply(): Int}) = d.apply() }
-object A2 { def apply(d: { def apply(): Int}) = d.apply() }
-object A3 { def apply(d: { def apply(): Int}) = d.apply() }
-object A4 { def apply(d: { def apply(): Int}) = d.apply() }
-
-class B extends Function0[Int] {
- def apply() = 3
-}
-
-object Test
-{
- type StructF0 = { def apply(): Int }
- def main(args: Array[String]) {
- for(i <- 0 until 150)
- println(i + " " + test(A.apply) + " " + test(A2.apply) + " " + test(A3.apply) + " " + test(A3.apply))
- }
-
- def test(withF0: StructF0 => Int): Int = {
- // Some large jar
- val ivyJar = File("/local/lib/java/ivy.jar").toURL
- // load a class in a separate loader that will be passed to A
- val loader = new java.net.URLClassLoader(Array(File(".").toURL, ivyJar))
- // load a real class to fill perm gen space
- Class.forName("org.apache.ivy.Ivy", true, loader).newInstance
- // create a class from another class loader with an apply: Int method
- val b = Class.forName("B", true, loader).newInstance
-
- // pass instance to a, which will call apply using structural type reflection.
- // This should hold on to the class for B, which means bLoader will not get collected
- withF0(b.asInstanceOf[StructF0])
- }
-}
diff --git a/test/pending/run/bug2365/bug2365.javaopts b/test/pending/run/bug2365/bug2365.javaopts
deleted file mode 100644
index 357e033c1c..0000000000
--- a/test/pending/run/bug2365/bug2365.javaopts
+++ /dev/null
@@ -1 +0,0 @@
--XX:MaxPermSize=25M
diff --git a/test/pending/run/castsingleton.scala b/test/pending/run/castsingleton.scala
deleted file mode 100644
index 171b380dc9..0000000000
--- a/test/pending/run/castsingleton.scala
+++ /dev/null
@@ -1,10 +0,0 @@
-object Test extends Application {
- case class L();
- object N extends L();
-
- def empty(xs : L) : Unit = xs match {
- case x@N => println(x); println(x);
- }
-
- empty(L())
-}
diff --git a/test/pending/run/t0807.scala b/test/pending/run/t0807.scala
deleted file mode 100644
index e69aa1c71c..0000000000
--- a/test/pending/run/t0807.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-trait A
-trait B extends A { val x = println("early") }
-object Test extends Application {
- new B {}
-}
diff --git a/test/pending/run/t1939.scala b/test/pending/run/t1939.scala
deleted file mode 100644
index 44ab1769d2..0000000000
--- a/test/pending/run/t1939.scala
+++ /dev/null
@@ -1,41 +0,0 @@
-// works in trunk
-class Module {}
-
-abstract class T {
- type moduleType <: Module
- def module: moduleType
-}
-
-final class T1(val module: Module) extends T {
- type moduleType = Module
-}
-
-final class T2(_module: Module) extends T {
- type moduleType = Module
-
- def module = _module
-}
-
-object Main extends Application {
-
- type mType = Module
-
- type tType = T { type moduleType <: mType }
- // type tType = T { type moduleType <: Module } // runs successfully
- // type tType = T // runs successfully
-
- def f(ts: List[tType]): Unit = {
-
- for (t <- ts; m = t.module) {}
- ts.map(_.module).foreach { _ => () }
- // ts.map(t => (t : T).module).foreach { _ => () } // runs successfully
- }
-
- f(new T1(new Module) :: new T2(new Module) :: Nil)
-}
-
-/*
- * java.lang.AbstractMethodError
- at scala.List.foreach(List.scala:849)
- at Main$.f
-*/
diff --git a/test/pending/scalacheck/CheckEither.scala b/test/pending/scalacheck/CheckEither.scala
deleted file mode 100644
index a6c728451b..0000000000
--- a/test/pending/scalacheck/CheckEither.scala
+++ /dev/null
@@ -1,253 +0,0 @@
-
-// To run these tests:
-// 1) wget http://scalacheck.googlecode.com/files/ScalaCheck-1.2.jar
-// 2) scalac -classpath ScalaCheck-1.2.jar Either.scala
-// 3) scala -classpath .:ScalaCheck-1.2.jar scala.CheckEither
-// 4) observe passing tests
-
-import org.scalacheck.Arbitrary
-import org.scalacheck.Arbitrary.{arbitrary, arbThrowable}
-import org.scalacheck.Gen.oneOf
-import org.scalacheck.{Prop, StdRand}
-import org.scalacheck.Prop._
-import org.scalacheck.ConsoleReporter.{testReport, propReport}
-import org.scalacheck.Test.{Params, check}
-import org.scalacheck.ConsoleReporter.testStatsEx
-import Function.tupled
-
-object CheckEither {
- implicit def arbitraryEither[X, Y](implicit xa: Arbitrary[X], ya: Arbitrary[Y]): Arbitrary[Either[X, Y]] =
- Arbitrary[Either[X, Y]](oneOf(arbitrary[X].map(Left(_)), arbitrary[Y].map(Right(_))))
-
- val prop_either1 = property((n: Int) => Left(n).either(x => x, b => error("fail")) == n)
-
- val prop_either2 = property((n: Int) => Right(n).either(a => error("fail"), x => x) == n)
-
- val prop_swap = property((e: Either[Int, Int]) => e match {
- case Left(a) => e.swap.right.value == a
- case Right(b) => e.swap.left.value == b
- })
-
- val prop_isLeftRight = property((e: Either[Int, Int]) => e.isLeft != e.isRight)
-
- object CheckLeftProjection {
- val prop_valueE = property((n: Int, s: String) => Left(n).left.valueE(s) == n)
-
- val prop_value = property((n: Int) => Left(n).left.value == n)
-
- val prop_on = property((e: Either[Int, Int]) => e.left.on((_: Int) + 1) == (e match {
- case Left(a) => a
- case Right(b) => b + 1
- }))
-
- val prop_getOrElse = property((e: Either[Int, Int], or: Int) => e.left.getOrElse(or) == (e match {
- case Left(a) => a
- case Right(_) => or
- }))
-
- val prop_forall = property((e: Either[Int, Int]) =>
- e.left.forall(_ % 2 == 0) == (e.isRight || e.left.value % 2 == 0))
-
- val prop_exists = property((e: Either[Int, Int]) =>
- e.left.exists(_ % 2 == 0) == (e.isLeft && e.left.value % 2 == 0))
-
- val prop_flatMapLeftIdentity = property((e: Either[Int, Int], n: Int, s: String) => {
- def f(x: Int) = if(x % 2 == 0) Left(s) else Right(s)
- Left(n).left.flatMap(f(_)) == f(n)})
-
- val prop_flatMapRightIdentity = property((e: Either[Int, Int]) => e.left.flatMap(Left(_)) == e)
-
- val prop_flatMapComposition = property((e: Either[Int, Int]) => {
- def f(x: Int) = if(x % 2 == 0) Left(x) else Right(x)
- def g(x: Int) = if(x % 7 == 0) Right(x) else Left(x)
- e.left.flatMap(f(_)).left.flatMap(g(_)) == e.left.flatMap(f(_).left.flatMap(g(_)))})
-
- val prop_mapIdentity = property((e: Either[Int, Int]) => e.left.map(x => x) == e)
-
- val prop_mapComposition = property((e: Either[String, Int]) => {
- def f(s: String) = s.toLowerCase
- def g(s: String) = s.reverse
- e.left.map(x => f(g(x))) == e.left.map(x => g(x)).left.map(f(_))})
-
- val prop_filter = property((e: Either[Int, Int], x: Int) => e.left.filter(_ % 2 == 0) ==
- (if(e.isRight || e.left.value % 2 != 0) None else Some(e)))
-
- val prop_ap = property((e1: Either[Int, Int], e2: Either[Int, Int]) => {
- val ee2 = e2.left map (n => (x: Int) => x + n)
- e1.left.ap(ee2) == (ee2 match {
- case Left(f) => e1 match {
- case Left(a) => Left(f(a))
- case Right(b) => Right(b)
- }
- case Right(b) => Right(b)
- })
- })
-
- val prop_seq = property((e: Either[Int, Int]) => e.left.seq == (e match {
- case Left(a) => Seq.singleton(a)
- case Right(_) => Seq.empty
- }))
-
- val prop_option = property((e: Either[Int, Int]) => e.left.option == (e match {
- case Left(a) => Some(a)
- case Right(_) => None
- }))
- }
-
- object CheckRightProjection {
- val prop_valueE = property((n: Int, s: String) => Right(n).right.valueE(s) == n)
-
- val prop_value = property((n: Int) => Right(n).right.value == n)
-
- val prop_on = property((e: Either[Int, Int]) => e.right.on((_: Int) + 1) == (e match {
- case Left(a) => a + 1
- case Right(b) => b
- }))
-
- val prop_getOrElse = property((e: Either[Int, Int], or: Int) => e.right.getOrElse(or) == (e match {
- case Left(_) => or
- case Right(b) => b
- }))
-
- val prop_forall = property((e: Either[Int, Int]) =>
- e.right.forall(_ % 2 == 0) == (e.isLeft || e.right.value % 2 == 0))
-
- val prop_exists = property((e: Either[Int, Int]) =>
- e.right.exists(_ % 2 == 0) == (e.isRight && e.right.value % 2 == 0))
-
- val prop_flatMapLeftIdentity = property((e: Either[Int, Int], n: Int, s: String) => {
- def f(x: Int) = if(x % 2 == 0) Left(s) else Right(s)
- Right(n).right.flatMap(f(_)) == f(n)})
-
- val prop_flatMapRightIdentity = property((e: Either[Int, Int]) => e.right.flatMap(Right(_)) == e)
-
- val prop_flatMapComposition = property((e: Either[Int, Int]) => {
- def f(x: Int) = if(x % 2 == 0) Left(x) else Right(x)
- def g(x: Int) = if(x % 7 == 0) Right(x) else Left(x)
- e.right.flatMap(f(_)).right.flatMap(g(_)) == e.right.flatMap(f(_).right.flatMap(g(_)))})
-
- val prop_mapIdentity = property((e: Either[Int, Int]) => e.right.map(x => x) == e)
-
- val prop_mapComposition = property((e: Either[Int, String]) => {
- def f(s: String) = s.toLowerCase
- def g(s: String) = s.reverse
- e.right.map(x => f(g(x))) == e.right.map(x => g(x)).right.map(f(_))})
-
- val prop_filter = property((e: Either[Int, Int], x: Int) => e.right.filter(_ % 2 == 0) ==
- (if(e.isLeft || e.right.value % 2 != 0) None else Some(e)))
-
- val prop_ap = property((e1: Either[Int, Int], e2: Either[Int, Int]) => {
- val ee2 = e2.right map (n => (x: Int) => x + n)
- e1.right.ap(ee2) == (ee2 match {
- case Left(a) => Left(a)
- case Right(f) => e1 match {
- case Left(a) => Left(a)
- case Right(b) => Right(f(b))
- }
- })
- })
-
- val prop_seq = property((e: Either[Int, Int]) => e.right.seq == (e match {
- case Left(_) => Seq.empty
- case Right(b) => Seq.singleton(b)
- }))
-
- val prop_option = property((e: Either[Int, Int]) => e.right.option == (e match {
- case Left(_) => None
- case Right(b) => Some(b)
- }))
- }
-
- val prop_Either_left = property((n: Int) => Either.left(n).left.value == n)
-
- val prop_Either_right = property((n: Int) => Either.right(n).right.value == n)
-
- val prop_Either_joinLeft = property((e: Either[Either[Int, Int], Int]) => e match {
- case Left(ee) => Either.joinLeft(e) == ee
- case Right(n) => Either.joinLeft(e) == Right(n)
- })
-
- val prop_Either_joinRight = property((e: Either[Int, Either[Int, Int]]) => e match {
- case Left(n) => Either.joinRight(e) == Left(n)
- case Right(ee) => Either.joinRight(e) == ee
- })
-
- val prop_Either_lefts = property((es: List[Either[Int, Int]]) =>
- Either.lefts(es) == es.filter(_.isLeft).map(_.left.value))
-
- val prop_Either_rights = property((es: List[Either[Int, Int]]) =>
- Either.rights(es) == es.filter(_.isRight).map(_.right.value))
-
- val prop_Either_leftRights = property((es: List[Either[Int, Int]]) =>
- Either.rights(es) == es.filter(_.isRight).map(_.right.value))
-
- val prop_Either_throws = property((n: Int) =>
- Either.throws(n) == Right(n) && Either.throws(error("error")).isLeft)
-
- val prop_Either_throwIt = property((e: Either[Throwable, Int]) =>
- try {
- Either.throwIt(e) == e.right.value
- } catch {
- case (t) => e.isLeft && e.left.value == t
- })
-
- val prop_Either_reduce = property((e: Either[Int, Int]) =>
- Either.reduce(e) == (e match {
- case Left(a) => a
- case Right(a) => a
- }))
-
- val prop_Either_iif = property((c: Boolean, a: Int, b: Int) =>
- Either.iif(c, a, b) == (if(c) Right(b) else Left(a)))
-
- val tests = List(
- ("prop_either1", prop_either1),
- ("prop_either2", prop_either2),
- ("prop_swap", prop_swap),
- ("prop_isLeftRight", prop_isLeftRight),
- ("Left.prop_valueE", CheckLeftProjection.prop_valueE),
- ("Left.prop_value", CheckLeftProjection.prop_value),
- ("Left.prop_getOrElse", CheckLeftProjection.prop_getOrElse),
- ("Left.prop_forall", CheckLeftProjection.prop_forall),
- ("Left.prop_exists", CheckLeftProjection.prop_exists),
- ("Left.prop_flatMapLeftIdentity", CheckLeftProjection.prop_flatMapLeftIdentity),
- ("Left.prop_flatMapRightIdentity", CheckLeftProjection.prop_flatMapRightIdentity),
- ("Left.prop_flatMapComposition", CheckLeftProjection.prop_flatMapComposition),
- ("Left.prop_mapIdentity", CheckLeftProjection.prop_mapIdentity),
- ("Left.prop_mapComposition", CheckLeftProjection.prop_mapComposition),
- ("Left.prop_filter", CheckLeftProjection.prop_filter),
- ("Left.prop_ap", CheckLeftProjection.prop_ap),
- ("Left.prop_seq", CheckLeftProjection.prop_seq),
- ("Left.prop_option", CheckLeftProjection.prop_option),
- ("Right.prop_valueE", CheckRightProjection.prop_valueE),
- ("Right.prop_value", CheckRightProjection.prop_value),
- ("Right.prop_getOrElse", CheckRightProjection.prop_getOrElse),
- ("Right.prop_forall", CheckRightProjection.prop_forall),
- ("Right.prop_exists", CheckRightProjection.prop_exists),
- ("Right.prop_flatMapLeftIdentity", CheckRightProjection.prop_flatMapLeftIdentity),
- ("Right.prop_flatMapRightIdentity", CheckRightProjection.prop_flatMapRightIdentity),
- ("Right.prop_flatMapComposition", CheckRightProjection.prop_flatMapComposition),
- ("Right.prop_mapIdentity", CheckRightProjection.prop_mapIdentity),
- ("Right.prop_mapComposition", CheckRightProjection.prop_mapComposition),
- ("Right.prop_filter", CheckRightProjection.prop_filter),
- ("Right.prop_ap", CheckRightProjection.prop_ap),
- ("Right.prop_seq", CheckRightProjection.prop_seq),
- ("Right.prop_option", CheckRightProjection.prop_option),
- ("prop_Either_left", prop_Either_left),
- ("prop_Either_right", prop_Either_right),
- ("prop_Either_joinLeft", prop_Either_joinLeft),
- ("prop_Either_joinRight", prop_Either_joinRight),
- ("prop_Either_lefts", prop_Either_lefts),
- ("prop_Either_rights", prop_Either_rights),
- ("prop_Either_leftRights", prop_Either_leftRights),
- ("prop_Either_throws", prop_Either_throws),
- ("prop_Either_throwIt", prop_Either_throwIt),
- ("prop_Either_reduce", prop_Either_reduce),
- ("prop_Either_iif", prop_Either_iif)
- )
-
- def main(args: Array[String]) =
- tests foreach (tupled((name, prop) =>
- testStatsEx(name, testReport(check(Params(500, 0, 0, 500, StdRand), prop, propReport)))))
-}
-
diff --git a/test/pending/run/bug2365/run b/test/pending/script/bug2365.sh
index f3c44ad086..f3c44ad086 100755
--- a/test/pending/run/bug2365/run
+++ b/test/pending/script/bug2365.sh
diff --git a/test/pending/script/errors.check b/test/pending/script/error-messages.check
index 1aee1fb44a..1aee1fb44a 100644
--- a/test/pending/script/errors.check
+++ b/test/pending/script/error-messages.check
diff --git a/test/pending/script/errors.scala b/test/pending/script/error-messages.scala
index 2e2025b203..2e2025b203 100644
--- a/test/pending/script/errors.scala
+++ b/test/pending/script/error-messages.scala