summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-03-01 05:59:11 +0000
committerPaul Phillips <paulp@improving.org>2010-03-01 05:59:11 +0000
commit07f1f6dd14f8342f40f139781317755ceb661b96 (patch)
treee7f393e2e678fa946b80a9858bc6b0f6e51fb1f9 /test
parentb94c6e0da6d33bc69f1419634128e2f401109b61 (diff)
downloadscala-07f1f6dd14f8342f40f139781317755ceb661b96.tar.gz
scala-07f1f6dd14f8342f40f139781317755ceb661b96.tar.bz2
scala-07f1f6dd14f8342f40f139781317755ceb661b96.zip
Enabled scalacheck tests.
what must be legacy scalatest.* properties to partest.*, boldly assuming that the fact that partest is pretty much unusable outside of scalac means there are no users outside of scalac who might be disrupted by eliminating old property names. Review by community.
Diffstat (limited to 'test')
-rw-r--r--test/disabled/run/docgenerator.scala2
-rw-r--r--test/files/jvm/inner.scala4
-rw-r--r--test/files/run/programmatic-main.scala2
-rw-r--r--test/files/scalacheck/eqeq.scala32
-rwxr-xr-xtest/partest2
-rwxr-xr-xtest/partest.bat2
6 files changed, 32 insertions, 12 deletions
diff --git a/test/disabled/run/docgenerator.scala b/test/disabled/run/docgenerator.scala
index 59f90ba415..247ad17b45 100644
--- a/test/disabled/run/docgenerator.scala
+++ b/test/disabled/run/docgenerator.scala
@@ -10,7 +10,7 @@ object Test {
def main(args: Array[String]) {
// overwrites value of UrlContext.generator in file DocUtil.scala
System.setProperty("doc.generator", "scaladoc")
- var dirname = System.getProperty("scalatest.output")
+ var dirname = System.getProperty("partest.output")
if (dirname eq null) dirname = System.getProperty("java.io.tmpdir")
val tmpDir = new File(dirname)
tmpDir.mkdirs()
diff --git a/test/files/jvm/inner.scala b/test/files/jvm/inner.scala
index 51e3909ef3..d6b055e998 100644
--- a/test/files/jvm/inner.scala
+++ b/test/files/jvm/inner.scala
@@ -53,8 +53,8 @@ class A {
}
object Scalatest {
- private val outputdir = System.getProperty("scalatest.output", "inner-jvm.obj")
- private val scalalib = System.getProperty("scalatest.lib", "")
+ private val outputdir = System.getProperty("partest.output", "inner-jvm.obj")
+ private val scalalib = System.getProperty("partest.lib", "")
private val classpath = outputdir + File.pathSeparator + scalalib
private val javabin = {
val jhome = new File(System.getProperty("java.home"))
diff --git a/test/files/run/programmatic-main.scala b/test/files/run/programmatic-main.scala
index 0e91d219a7..c97e4a8f3f 100644
--- a/test/files/run/programmatic-main.scala
+++ b/test/files/run/programmatic-main.scala
@@ -3,7 +3,7 @@ import io.Path
object Test
{
- val cwd = Option(System.getProperty("scalatest.cwd")) getOrElse "."
+ val cwd = Option(System.getProperty("partest.cwd")) getOrElse "."
val basedir = (Path(cwd).parent / "lib").path
val baseargs = Array("-bootclasspath", basedir + "/scala-library.jar", "-cp", basedir + "/scala-compiler.jar")
diff --git a/test/files/scalacheck/eqeq.scala b/test/files/scalacheck/eqeq.scala
index 163f17d94c..60fe63c207 100644
--- a/test/files/scalacheck/eqeq.scala
+++ b/test/files/scalacheck/eqeq.scala
@@ -3,15 +3,35 @@ import Prop._
import Gen._
object Test extends Properties("==") {
- property("reflexive") = forAll { (x: AnyVal, y: AnyVal) => (x == y) == (y == x) }
- // property("hashCode") = forAll { (x
+ def equalObjectsEqualHashcodes(x: Any, y: Any) = (x != y) || (x == y && x.## == y.##)
+ // ticket #2087
property("short/char") = forAll { (x: Short) => {
val ch: Char = x.toChar
- (x == ch) == (ch == x) ||
- // that's the whole test once it works, but since it doesn't yet:
- x < 0
+ (x == ch) == (ch == x)
}
}
-}
+ property("symmetry") = forAll { (x: AnyVal, y: AnyVal) => (x == y) == (y == x) }
+ property("transitivity") = forAll { (x: AnyVal, y: AnyVal, z: AnyVal) => x != y || y != z || x == z }
+
+ property("##") = forAll {
+ (x: Short) => {
+ val anyvals = List(x.toByte, x.toChar, x, x.toInt, x.toLong, x.toFloat, x.toDouble, BigInt(x), BigDecimal(x))
+ val shortAndLarger = anyvals drop 2
+
+ val result = (
+ ((anyvals, anyvals).zipped forall equalObjectsEqualHashcodes) &&
+ ((shortAndLarger, shortAndLarger).zipped forall (_ == _)) &&
+ ((shortAndLarger, shortAndLarger).zipped forall ((x, y) => (x: Any) == (y: Any)))
+ )
+ result
+ }
+ }
+ property("## 2") = forAll {
+ (dv: Double) => {
+ val fv = dv.toFloat
+ (fv != dv) || (fv.## == dv.##)
+ }
+ }
+}
diff --git a/test/partest b/test/partest
index 6c0190dd31..1e7da8bd4a 100755
--- a/test/partest
+++ b/test/partest
@@ -83,4 +83,4 @@ if [ ! -z "${PARTEST_DEBUG}" ] ; then
partestDebugStr="-Dpartest.debug=${PARTEST_DEBUG}"
fi
-${JAVACMD:=java} $JAVA_OPTS -cp "$EXT_CLASSPATH" ${partestDebugStr} -Dscala.home="${SCALA_HOME}" -Dscalatest.javacmd="${JAVACMD}" -Dscalatest.java_opts="${JAVA_OPTS}" -Dscalatest.scalac_opts="${SCALAC_OPTS}" -Dscalatest.javac_cmd="${JAVA_HOME}/bin/javac" scala.tools.partest.nest.NestRunner "$@"
+${JAVACMD:=java} $JAVA_OPTS -cp "$EXT_CLASSPATH" ${partestDebugStr} -Dscala.home="${SCALA_HOME}" -Dpartest.javacmd="${JAVACMD}" -Dpartest.java_opts="${JAVA_OPTS}" -Dpartest.scalac_opts="${SCALAC_OPTS}" -Dpartest.javac_cmd="${JAVA_HOME}/bin/javac" scala.tools.partest.nest.NestRunner "$@"
diff --git a/test/partest.bat b/test/partest.bat
index 861c0a2465..39fe830082 100755
--- a/test/partest.bat
+++ b/test/partest.bat
@@ -53,7 +53,7 @@ if "%_EXTENSION_CLASSPATH%"=="" (
)
)
-set _PROPS=-Dscala.home="%_SCALA_HOME%" -Dscalatest.javacmd="%_JAVACMD%" -Dscalatest.java_options="%_JAVA_OPTS%" -Dscalatest.scalac_options="%_SCALAC_OPTS%" -Dscalatest.javac_cmd="%JAVA_HOME%\bin\javac"
+set _PROPS=-Dscala.home="%_SCALA_HOME%" -Dpartest.javacmd="%_JAVACMD%" -Dpartest.java_options="%_JAVA_OPTS%" -Dpartest.scalac_options="%_SCALAC_OPTS%" -Dpartest.javac_cmd="%JAVA_HOME%\bin\javac"
rem echo %_JAVACMD% %_JAVA_OPTS% %_PROPS% -cp "%_EXTENSION_CLASSPATH%" scala.tools.partest.nest.NestRunner %_ARGS%
%_JAVACMD% %_JAVA_OPTS% %_PROPS% -cp "%_EXTENSION_CLASSPATH%" scala.tools.partest.nest.NestRunner %_ARGS%