Skip to content

Commit 42a136c

Browse files
Burak Emiradriaanm
Burak Emir
authored andcommitted
fixed test case + strict checking for atom
1 parent 73d2620 commit 42a136c

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

src/library/scala/xml/Atom.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ import compat.StringBuilder;
2121
[serializable]
2222
class Atom[+A]( val data: A ) extends SpecialNode {
2323

24+
data match {
25+
case null => new IllegalArgumentException("cannot construct Atom(null)")
26+
case _ =>
27+
}
2428
final override def typeTag$:Int = -1;
2529

2630
/** the constant "#PCDATA"

test/files/jvm/xml03syntax.check

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
<hello>()</hello>
21
passed ok
3-
<hello>()</hello>
2+
passed ok
43
passed ok
54
<hello>world</hello>
65
passed ok

test/files/jvm/xml03syntax.scala

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,18 @@ object Test {
1313
import NodeSeq.view
1414
import testing.UnitTest._
1515

16-
val x0 = <hello>{}</hello>
17-
val x00 = <hello>{ }</hello>
16+
val xNull = <hello>{null}</hello> // these used to be Atom(unit), changed to empty children
17+
18+
assertSameElements( xNull.child, Nil )
19+
20+
val x0 = <hello>{}</hello> // these used to be Atom(unit), changed to empty children
21+
val x00 = <hello>{ }</hello> // dto.
22+
1823
val xa = <hello>{ "world" }</hello>
1924

2025

21-
assertEquals( handle[Unit](x0), {} )
22-
assertEquals( handle[Unit](x00), {} )
26+
assertSameElements( x0.child, Nil )
27+
assertSameElements( x00.child, Nil )
2328
assertEquals( handle[String](xa),"world" )
2429

2530
val xb = <hello>{ 1.5 }</hello>

0 commit comments

Comments
 (0)