diff options
author | michelou <michelou@epfl.ch> | 2007-12-19 16:52:40 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2007-12-19 16:52:40 +0000 |
commit | 8ad43107f52b278930a663874943de9eda0c8df0 (patch) | |
tree | 2e7fa80109cdd1a2ba1053aad0ff951132f71251 /src/library | |
parent | 999d30eea73cc19ff1603fc57c13d937c4fc6ce2 (diff) | |
download | scala-8ad43107f52b278930a663874943de9eda0c8df0.tar.gz scala-8ad43107f52b278930a663874943de9eda0c8df0.tar.bz2 scala-8ad43107f52b278930a663874943de9eda0c8df0.zip |
removed deprecated features
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/All$.scala | 25 | ||||
-rw-r--r-- | src/library/scala/AllRef$.scala | 25 | ||||
-rw-r--r-- | src/library/scala/Predef.scala | 6 | ||||
-rw-r--r-- | src/library/scala/Product.scala | 15 | ||||
-rw-r--r-- | src/library/scala/compat/Math.scala | 54 | ||||
-rw-r--r-- | src/library/scala/testing/SUnit.scala | 46 | ||||
-rw-r--r-- | src/library/scala/testing/UnitTest.scala | 95 |
7 files changed, 12 insertions, 254 deletions
diff --git a/src/library/scala/All$.scala b/src/library/scala/All$.scala deleted file mode 100644 index 879e18a259..0000000000 --- a/src/library/scala/All$.scala +++ /dev/null @@ -1,25 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id: All$.scala 9262 2006-11-14 17:29:59Z mihaylov $ - - -package scala - - -/** - * Dummy class which exist only to satisfy the JVM. It corresponds - * to <code>scala.All</code>. If such type appears in method - * signatures, it is erased to this one. - * - * @deprecated <i>To be removed at some time in the future. Kept only for - * backward compatibility. Newly compiled code will refer to - * <code>scala.runtime.Nothing$</code></i> - */ - -sealed abstract class All$ diff --git a/src/library/scala/AllRef$.scala b/src/library/scala/AllRef$.scala deleted file mode 100644 index dcfd9ad300..0000000000 --- a/src/library/scala/AllRef$.scala +++ /dev/null @@ -1,25 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id: AllRef$.scala 10086 2007-02-21 19:10:41Z odersky $ - - -package scala - - -/** - * Dummy class which exist only to satisfy the JVM. It corresponds - * to <code>scala.AllRef</code>. If such type appears in method - * signatures, it is erased to this one. - * - * @deprecated <i>To be removed at some time in the future. Kept only for - * backward compatibility. Newly compiled code will refer to - * <code>scala.runtime.Null$</code></i> - */ - -sealed abstract class AllRef$ diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala index 6d3ac1aafe..60042b1862 100644 --- a/src/library/scala/Predef.scala +++ b/src/library/scala/Predef.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** @@ -35,10 +35,6 @@ object Predef { type boolean = scala.Boolean type unit = scala.Unit - /** @deprecated use <code>Nothing</code> instead */ - @deprecated type All = Nothing - /** @deprecated use <code>Null</code> instead */ - @deprecated type AllRef = Null /** @deprecated use <code>Int</code> instead */ @deprecated type Integer = java.lang.Integer /** @deprecated use <code>Char</code> instead */ diff --git a/src/library/scala/Product.scala b/src/library/scala/Product.scala index 65567a6616..bc77c939ad 100644 --- a/src/library/scala/Product.scala +++ b/src/library/scala/Product.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** @@ -28,23 +28,10 @@ trait Product extends AnyRef { */ def productElement(n: Int): Any - /** for a case class <code>A(x_1,...,x_k))</code>, returns <code>x_(i+1)</code> - * for <code>0 <= i < k</code> - * - * @param n the position of the n-th element - * @throws IndexOutOfBoundsException - * @return ... - */ - @deprecated def element(n: Int): Any = productElement(n) - /** return k for a product <code>A(x_1,...,x_k))</code> */ def productArity: Int - /** return k for a product <code>A(x_1,...,x_k))</code> - */ - @deprecated def arity: Int = productArity - /** * By default the empty string. Implementations may override this * method in order to prepend a string prefix to the result of the diff --git a/src/library/scala/compat/Math.scala b/src/library/scala/compat/Math.scala deleted file mode 100644 index 04a103d8df..0000000000 --- a/src/library/scala/compat/Math.scala +++ /dev/null @@ -1,54 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id$ - - -package scala.compat - -/** - * This class will be removed soon. Use <code>scala.Math</code> instead. - */ -@deprecated -object Math { - val MIN_BYTE = java.lang.Byte.MIN_VALUE - val MAX_BYTE = java.lang.Byte.MAX_VALUE - val MIN_SHORT = java.lang.Short.MIN_VALUE - val MAX_SHORT = java.lang.Short.MAX_VALUE - val MIN_CHAR = java.lang.Character.MIN_VALUE - val MAX_CHAR = java.lang.Character.MAX_VALUE - val MIN_INT = java.lang.Integer.MIN_VALUE - val MAX_INT = java.lang.Integer.MAX_VALUE - val MIN_LONG = java.lang.Long.MIN_VALUE - val MAX_LONG = java.lang.Long.MAX_VALUE - - val MIN_FLOAT = -java.lang.Float.MAX_VALUE - val EPS_FLOAT = java.lang.Float.MIN_VALUE - val MAX_FLOAT = java.lang.Float.MAX_VALUE - val NaN_FLOAT = java.lang.Float.NaN - val NEG_INF_FLOAT = java.lang.Float.NEGATIVE_INFINITY - val POS_INF_FLOAT = java.lang.Float.POSITIVE_INFINITY - - val MIN_DOUBLE = -java.lang.Double.MAX_VALUE - val EPS_DOUBLE = java.lang.Double.MIN_VALUE - val MAX_DOUBLE = java.lang.Double.MAX_VALUE - val NaN_DOUBLE = java.lang.Double.NaN - val NEG_INF_DOUBLE = java.lang.Double.NEGATIVE_INFINITY - val POS_INF_DOUBLE = java.lang.Double.POSITIVE_INFINITY - - val E = java.lang.Math.E - val PI = java.lang.Math.PI - - def min(x: Int, y: Int): Int = java.lang.Math.min(x, y) - def max(x: Int, y: Int): Int = java.lang.Math.max(x, y) - - def ceil (x: Double): Double = java.lang.Math.ceil(x) - def floor(x: Double): Double = java.lang.Math.floor(x) - def log (x: Double): Double = java.lang.Math.log(x) - def sqrt (x: Double): Double = java.lang.Math.sqrt(x) -} diff --git a/src/library/scala/testing/SUnit.scala b/src/library/scala/testing/SUnit.scala index e048cadedf..1a87c64b0e 100644 --- a/src/library/scala/testing/SUnit.scala +++ b/src/library/scala/testing/SUnit.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2008, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** @@ -163,6 +163,12 @@ object SUnit { def enableStackTrace: Boolean = true + /** fails if <code>! actual.sameElements(expected)</code> */ + def assertSameElements[A](actual: Seq[A], expected: Seq[A]) { + if (! actual.sameElements(expected)) + fail("(no message)", actual.toString, expected.toString) + } + /** fails if expected != actual */ def assertEquals[A](msg: String, expected: A, actual: A) { if (expected != actual) fail(msg, expected, actual) @@ -192,28 +198,12 @@ object SUnit { def assertNotNull(actual: AnyRef): Unit = assertNotNull("(no message)", actual) - /** - * @deprecated use assertNotEq instead - */ - @deprecated - def assertNotSame(msg: String, expected: AnyRef, actual: AnyRef) { - if (expected eq actual) fail(msg) - } - - /** - * @deprecated use assertNotEq instead - */ - @deprecated - def assertNotSame(expected: AnyRef, actual: AnyRef) { - assertNotEq("(no message)", expected, actual) - } - - /** fail if expected eq actual */ + /** fails if <code>expected eq actual</code> */ def assertNotEq(msg: String, expected: AnyRef, actual: AnyRef) { if (expected eq actual) fail(msg) } - /** fail if expected eq actual */ + /** fails if <code>expected eq actual</code> */ def assertNotEq(expected: AnyRef, actual: AnyRef) { assertNotEq("(no message)", expected, actual) } @@ -228,23 +218,7 @@ object SUnit { assertNull("(no message)", actual) } - /** - * @deprecated use assertEq instead - */ - @deprecated - def assertSame(msg: String, expected: AnyRef, actual: AnyRef) { - if (expected ne actual) fail(msg) - } - - /** - * @deprecated use assertEq instead - */ - @deprecated - def assertSame(expected: AnyRef, actual: AnyRef) { - assertEq("(no message)", expected, actual) - } - - /** fails if expected ne actual */ + /** fails if <code>expected ne actual</code> */ def assertEq(msg: String, expected: AnyRef, actual: AnyRef) { if (expected ne actual) fail(msg) } diff --git a/src/library/scala/testing/UnitTest.scala b/src/library/scala/testing/UnitTest.scala deleted file mode 100644 index 79aa0cbf2e..0000000000 --- a/src/library/scala/testing/UnitTest.scala +++ /dev/null @@ -1,95 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id$ - - -package scala.testing - -/** - * Some simple methods to support unit testing with assertions - * to contain more JUnit style assertions which use Scala's features. - * - * @author Burak Emir - * - * @deprecated use <a href="SUnit.html" target="contentFrame">SUnit</a> - * instead. - */ -@deprecated -object UnitTest { - - class Report(report_ok: () => Unit, report_fail: (String,String) => Unit) { - def ok(): Unit = report_ok() - def fail(actual: String, expected: String) { - report_fail(actual, expected) - } - } - - var report = new Report( - { () => Console.println("passed ok") }, - { (actual: String, expected: String) => - Console.print("failed! we got ") - Console.print( "\""+ actual +"\"" ) - Console.println(" but expected \"" + expected + "\"") }) - - /** - * @param r ... - */ - def setReporter(r: Report) { - this.report = r - } - - /** - * @param actual ... - * @param expected ... - */ - def assertSameElements[A](actual: Seq[A], expected: Seq[A]) { - if (actual.sameElements(expected)) - report.ok - else - report.fail(actual.toString, expected.toString) - } - - /** - * @param actual ... - * @param expected ... - */ - def assertEquals[A](actual: A, expected: A) { - if (actual == expected) - report.ok - else - report.fail(actual.toString(), expected.toString()) - } - - def assertTrue(actual: Boolean) { assertEquals(actual, true) } - def assertFalse(actual: Boolean) { assertEquals(actual, false) } - - def assertNull(actual: AnyRef) { - if (actual eq null) - report.ok - else - report.fail(actual.toString, "null") - } - - def assertNonNull(actual: AnyRef) { - if (actual ne null) - report.ok - else - report.fail(actual.toString, "null") - } - - def assertNotEquals[A](actual: A, expected: A) { - if (actual != expected) - report.ok - else - report.fail(actual.toString(), "x != "+expected.toString()) - } - - //def test[a](def doit: a, expected: a): Unit = assertEquals(doit, expected) - -} // unitTest |