diff options
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/testing/UnitTest.scala | 13 | ||||
-rw-r--r-- | src/library/scala/xml/Atom.scala | 4 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/library/scala/testing/UnitTest.scala b/src/library/scala/testing/UnitTest.scala index 38b6fb17e3..302ab6dc4a 100644 --- a/src/library/scala/testing/UnitTest.scala +++ b/src/library/scala/testing/UnitTest.scala @@ -61,6 +61,19 @@ object UnitTest { def assertTrue(actual: Boolean): Unit = assertEquals(actual, true) def assertFalse(actual: Boolean): Unit = assertEquals(actual, false) + def assertNull(actual: AnyRef): Unit = + if (actual eq null) + report.ok + else + report.fail(actual.toString, "null") + + def assertNonNull(actual: AnyRef): Unit = + if (actual ne null) + report.ok + else + report.fail(actual.toString, "null") + + def assertNotEquals[a]( actual: a, expected: a): Unit = if (actual != expected) report.ok diff --git a/src/library/scala/xml/Atom.scala b/src/library/scala/xml/Atom.scala index 74e572a556..0bbf65f979 100644 --- a/src/library/scala/xml/Atom.scala +++ b/src/library/scala/xml/Atom.scala @@ -21,6 +21,10 @@ import compat.StringBuilder; [serializable] class Atom[+A]( val data: A ) extends SpecialNode { + data match { + case null => new IllegalArgumentException("cannot construct Atom(null)") + case _ => + } final override def typeTag$:Int = -1; /** the constant "#PCDATA" |