summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/array-existential-bound.check4
-rw-r--r--test/files/run/array-existential-bound.scala17
-rw-r--r--test/files/run/mixin-bridge-methods.scala14
-rw-r--r--test/files/run/origins.scala2
-rw-r--r--test/files/run/repl-power.check22
-rw-r--r--test/files/run/repl-power.scala4
-rw-r--r--test/files/run/t3758.scala10
-rw-r--r--test/files/run/t4024.scala11
-rw-r--r--test/files/run/t4871.check2
-rw-r--r--test/files/run/t4871.scala12
-rw-r--r--test/files/run/t5053.check6
-rw-r--r--test/files/run/t5053.scala20
-rw-r--r--test/files/run/t5239.check13
-rw-r--r--test/files/run/t5266_1.check2
-rw-r--r--test/files/run/t5266_1.scala16
-rw-r--r--test/files/run/t5266_2.check2
-rw-r--r--test/files/run/t5266_2.scala (renamed from test/files/run/t5239.scala)11
-rw-r--r--test/files/run/t5293.scala83
-rw-r--r--test/files/run/t5300.scala7
-rw-r--r--test/files/run/t5356.check6
-rw-r--r--test/files/run/t5356.scala12
-rw-r--r--test/files/run/treePrint.scala2
-rw-r--r--test/files/run/type-currying.check27
-rw-r--r--test/files/run/type-currying.scala58
-rw-r--r--test/files/run/virtpatmat_literal.scala3
-rw-r--r--test/files/run/virtpatmat_opt_sharing.check1
-rw-r--r--test/files/run/virtpatmat_opt_sharing.flags1
-rw-r--r--test/files/run/virtpatmat_opt_sharing.scala10
-rw-r--r--test/files/run/virtpatmat_unapplyprod.check4
-rw-r--r--test/files/run/virtpatmat_unapplyprod.flags1
-rw-r--r--test/files/run/virtpatmat_unapplyprod.scala23
-rw-r--r--test/files/run/xml-attribute.scala33
32 files changed, 413 insertions, 26 deletions
diff --git a/test/files/run/array-existential-bound.check b/test/files/run/array-existential-bound.check
new file mode 100644
index 0000000000..f5cca843e3
--- /dev/null
+++ b/test/files/run/array-existential-bound.check
@@ -0,0 +1,4 @@
+2
+1000
+1000
+26
diff --git a/test/files/run/array-existential-bound.scala b/test/files/run/array-existential-bound.scala
new file mode 100644
index 0000000000..bc442d39f7
--- /dev/null
+++ b/test/files/run/array-existential-bound.scala
@@ -0,0 +1,17 @@
+trait Fooz[Q <: Array[_]] {
+ def f0(x: Q) = x.length
+}
+
+object Test extends Fooz[Array[Int]] {
+ val f1 = new Fooz[Array[String]] { }
+ val f2 = new Fooz[Array[Int]] { }
+ val f3 = new Fooz[Array[Any]] { }
+ val f4 = new Fooz[Array[_]] { }
+
+ def main(args: Array[String]): Unit = {
+ println(f1.f0(Array[String]("a", "b")))
+ println(f2.f0(1 to 1000 toArray))
+ println(f3.f0((1 to 1000).toArray[Any]))
+ println(f4.f0('a' to 'z' toArray))
+ }
+}
diff --git a/test/files/run/mixin-bridge-methods.scala b/test/files/run/mixin-bridge-methods.scala
new file mode 100644
index 0000000000..e0340ebb12
--- /dev/null
+++ b/test/files/run/mixin-bridge-methods.scala
@@ -0,0 +1,14 @@
+trait Foo {
+ def getFoo() = "foo"
+}
+
+class Sub extends Foo {
+ def getBar() = "bar"
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val ms = classOf[Sub].getDeclaredMethods
+ assert(ms forall (x => !x.isBridge), ms mkString " ")
+ }
+}
diff --git a/test/files/run/origins.scala b/test/files/run/origins.scala
index ab873bca89..9dc6071c7b 100644
--- a/test/files/run/origins.scala
+++ b/test/files/run/origins.scala
@@ -1,4 +1,4 @@
-import scala.tools.nsc.util.Origins
+import scala.reflect.internal.util.Origins
package goxbox {
object Socks {
diff --git a/test/files/run/repl-power.check b/test/files/run/repl-power.check
index 38e7532133..1e7b6f0cd8 100644
--- a/test/files/run/repl-power.check
+++ b/test/files/run/repl-power.check
@@ -2,15 +2,31 @@ Type in expressions to have them evaluated.
Type :help for more information.
scala> :power
-** Power User mode enabled - BEEP BOOP SPIZ **
+** Power User mode enabled - BEEP WHIR GYVE **
** :phase has been set to 'typer'. **
** scala.tools.nsc._ has been imported **
-** global._ and definitions._ also imported **
-** Try :help, vals.<tab>, power.<tab> **
+** global._, definitions._ also imported **
+** Try :help, :vals, power.<tab> **
scala> // guarding against "error: reference to global is ambiguous"
scala> global.emptyValDef // "it is imported twice in the same scope by ..."
res0: $r.global.emptyValDef.type = private val _ = _
+scala> val tp = ArrayClass[scala.util.Random] // magic with manifests
+tp: $r.global.Type = Array[scala.util.Random]
+
+scala> tp.memberType(Array_apply) // evidence
+res1: $r.global.Type = (i: Int)scala.util.Random
+
+scala> val m = LIT(10) MATCH (CASE(LIT(5)) ==> FALSE, DEFAULT ==> TRUE) // treedsl
+m: $r.treedsl.global.Match =
+10 match {
+ case 5 => false
+ case _ => true
+}
+
+scala> typed(m).tpe // typed is in scope
+res2: $r.treedsl.global.Type = Boolean
+
scala>
diff --git a/test/files/run/repl-power.scala b/test/files/run/repl-power.scala
index 9f70ac4b68..27da3df106 100644
--- a/test/files/run/repl-power.scala
+++ b/test/files/run/repl-power.scala
@@ -5,6 +5,10 @@ object Test extends ReplTest {
:power
// guarding against "error: reference to global is ambiguous"
global.emptyValDef // "it is imported twice in the same scope by ..."
+val tp = ArrayClass[scala.util.Random] // magic with manifests
+tp.memberType(Array_apply) // evidence
+val m = LIT(10) MATCH (CASE(LIT(5)) ==> FALSE, DEFAULT ==> TRUE) // treedsl
+typed(m).tpe // typed is in scope
""".trim
}
diff --git a/test/files/run/t3758.scala b/test/files/run/t3758.scala
new file mode 100644
index 0000000000..18750b0a9c
--- /dev/null
+++ b/test/files/run/t3758.scala
@@ -0,0 +1,10 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ assert(classManifest[Array[String]].typeArguments contains classManifest[String])
+ assert(classManifest[Array[Int]].typeArguments contains classManifest[Int])
+ assert(classManifest[Array[Float]].typeArguments contains classManifest[Float])
+ assert(manifest[Array[String]].typeArguments contains manifest[String])
+ assert(manifest[Array[Int]].typeArguments contains manifest[Int])
+ assert(manifest[Array[Float]].typeArguments contains manifest[Float])
+ }
+}
diff --git a/test/files/run/t4024.scala b/test/files/run/t4024.scala
index ef768beb99..7c62a3fc6e 100644
--- a/test/files/run/t4024.scala
+++ b/test/files/run/t4024.scala
@@ -5,5 +5,16 @@ object Test extends App {
val m = x.getClass.getMethod("toString")
assert(m.invoke(x, (Nil: List[AnyRef]): _*) == "abc")
+
+ Test2.main(Array())
}
+
+object Test2 {
+ def main(args: Array[String]): Unit = {
+ val x = "abc"
+ val m = x.getClass.getMethod("toString")
+ m.invoke(x, Nil: _*)
+ m.invoke(x, Seq(): _*)
+ }
+}
diff --git a/test/files/run/t4871.check b/test/files/run/t4871.check
new file mode 100644
index 0000000000..a60526a0f3
--- /dev/null
+++ b/test/files/run/t4871.check
@@ -0,0 +1,2 @@
+class Test$C
+class Test$D
diff --git a/test/files/run/t4871.scala b/test/files/run/t4871.scala
new file mode 100644
index 0000000000..70d8b7145c
--- /dev/null
+++ b/test/files/run/t4871.scala
@@ -0,0 +1,12 @@
+object Test {
+ class C
+ class D
+
+ def main(args: Array[String]): Unit = {
+ val z: Class[C] = classOf
+ val z2: Class[D] = classOf[D]
+
+ println(z)
+ println(z2)
+ }
+}
diff --git a/test/files/run/t5053.check b/test/files/run/t5053.check
new file mode 100644
index 0000000000..5ec39bbdeb
--- /dev/null
+++ b/test/files/run/t5053.check
@@ -0,0 +1,6 @@
+true
+true
+true
+true
+true
+true
diff --git a/test/files/run/t5053.scala b/test/files/run/t5053.scala
new file mode 100644
index 0000000000..e46dad5ac6
--- /dev/null
+++ b/test/files/run/t5053.scala
@@ -0,0 +1,20 @@
+object Test extends App {
+ {
+ val (left, right) = Seq((1, "a"), (1, "a"), (1, "a"), (3, "c")).view.unzip
+ println(left.isInstanceOf[scala.collection.SeqViewLike[_,_,_]])
+ val (l, m, r) = Seq((1, 1.0, "a"), (1, 1.0, "a"), (1, 1.0, "a"), (3, 3.0, "c")).view.unzip3
+ println(l.isInstanceOf[scala.collection.SeqViewLike[_,_,_]])
+ }
+ {
+ val (left, right) = Iterable((1, "a"), (1, "a"), (1, "a"), (3, "c")).view.unzip
+ println(left.isInstanceOf[scala.collection.IterableViewLike[_,_,_]])
+ val (l, m, r) = Iterable((1, 1.0, "a"), (1, 1.0, "a"), (1, 1.0, "a"), (3, 3.0, "c")).view.unzip3
+ println(l.isInstanceOf[scala.collection.IterableViewLike[_,_,_]])
+ }
+ {
+ val (left, right) = Traversable((1, "a"), (1, "a"), (1, "a"), (3, "c")).view.unzip
+ println(left.isInstanceOf[scala.collection.TraversableViewLike[_,_,_]])
+ val (l, m, r) = Traversable((1, 1.0, "a"), (1, 1.0, "a"), (1, 1.0, "a"), (3, 3.0, "c")).view.unzip3
+ println(l.isInstanceOf[scala.collection.TraversableViewLike[_,_,_]])
+ }
+}
diff --git a/test/files/run/t5239.check b/test/files/run/t5239.check
deleted file mode 100644
index db5778f95b..0000000000
--- a/test/files/run/t5239.check
+++ /dev/null
@@ -1,13 +0,0 @@
-result = 2{Int(2)}
-[[syntax trees at end of typer]]// Scala source: NoSourceFile
-package <empty> {
- final object __wrapper$1 extends Object {
- def this(): object __wrapper$1 = {
- __wrapper$1.super.this();
- ()
- };
- <static> def wrapper(): Int = 2
- }
-}
-
-evaluated = 2
diff --git a/test/files/run/t5266_1.check b/test/files/run/t5266_1.check
new file mode 100644
index 0000000000..3feac16a0b
--- /dev/null
+++ b/test/files/run/t5266_1.check
@@ -0,0 +1,2 @@
+2
+evaluated = null \ No newline at end of file
diff --git a/test/files/run/t5266_1.scala b/test/files/run/t5266_1.scala
new file mode 100644
index 0000000000..18e288e685
--- /dev/null
+++ b/test/files/run/t5266_1.scala
@@ -0,0 +1,16 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val code = scala.reflect.Code.lift{
+ def x = 2
+ println(x)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ val evaluated = toolbox.runExpr(ttree)
+ println("evaluated = " + evaluated)
+} \ No newline at end of file
diff --git a/test/files/run/t5266_2.check b/test/files/run/t5266_2.check
new file mode 100644
index 0000000000..3feac16a0b
--- /dev/null
+++ b/test/files/run/t5266_2.check
@@ -0,0 +1,2 @@
+2
+evaluated = null \ No newline at end of file
diff --git a/test/files/run/t5239.scala b/test/files/run/t5266_2.scala
index 1f404196ba..eb319583f8 100644
--- a/test/files/run/t5239.scala
+++ b/test/files/run/t5266_2.scala
@@ -4,17 +4,14 @@ import reflect.runtime.Mirror.ToolBox
object Test extends App {
val code = scala.reflect.Code.lift{
- 2
+ def x = 2
+ def y = x
+ println(y)
};
- val settings = new Settings
- settings.Xprint.value = List("typer")
-
- val reporter = new ConsoleReporter(settings)
+ val reporter = new ConsoleReporter(new Settings)
val toolbox = new ToolBox(reporter)
val ttree = toolbox.typeCheck(code.tree)
- println("result = " + toolbox.showAttributed(ttree))
-
val evaluated = toolbox.runExpr(ttree)
println("evaluated = " + evaluated)
}
diff --git a/test/files/run/t5293.scala b/test/files/run/t5293.scala
new file mode 100644
index 0000000000..de1efaec4a
--- /dev/null
+++ b/test/files/run/t5293.scala
@@ -0,0 +1,83 @@
+
+
+
+import scala.collection.JavaConverters._
+
+
+
+object Test extends App {
+
+ def bench(label: String)(body: => Unit): Long = {
+ val start = System.nanoTime
+
+ 0.until(10).foreach(_ => body)
+
+ val end = System.nanoTime
+
+ //println("%s: %s ms".format(label, (end - start) / 1000.0 / 1000.0))
+
+ end - start
+ }
+
+ def benchJava(values: java.util.Collection[Int]) = {
+ bench("Java Set") {
+ val set = new java.util.HashSet[Int]
+
+ set.addAll(values)
+ }
+ }
+
+ def benchScala(values: Iterable[Int]) = {
+ bench("Scala Set") {
+ val set = new scala.collection.mutable.HashSet[Int]
+
+ set ++= values
+ }
+ }
+
+ def benchScalaSorted(values: Iterable[Int]) = {
+ bench("Scala Set sorted") {
+ val set = new scala.collection.mutable.HashSet[Int]
+
+ set ++= values.toArray.sorted
+ }
+ }
+
+ def benchScalaPar(values: Iterable[Int]) = {
+ bench("Scala ParSet") {
+ val set = new scala.collection.parallel.mutable.ParHashSet[Int] map { x => x }
+
+ set ++= values
+ }
+ }
+
+ val values = 0 until 50000
+ val set = scala.collection.mutable.HashSet.empty[Int]
+
+ set ++= values
+
+ // warmup
+ for (x <- 0 until 5) {
+ benchJava(set.asJava)
+ benchScala(set)
+ benchScalaPar(set)
+ benchJava(set.asJava)
+ benchScala(set)
+ benchScalaPar(set)
+ }
+
+ val javaset = benchJava(set.asJava)
+ val scalaset = benchScala(set)
+ val scalaparset = benchScalaPar(set)
+
+ assert(scalaset < (javaset * 4))
+ assert(scalaparset < (javaset * 4))
+}
+
+
+
+
+
+
+
+
diff --git a/test/files/run/t5300.scala b/test/files/run/t5300.scala
new file mode 100644
index 0000000000..073b29604a
--- /dev/null
+++ b/test/files/run/t5300.scala
@@ -0,0 +1,7 @@
+object Test {
+ val pf: PartialFunction[Any, Unit] = { case _ => () }
+
+ def main(args: Array[String]): Unit = {
+ pf orElse pf
+ }
+}
diff --git a/test/files/run/t5356.check b/test/files/run/t5356.check
new file mode 100644
index 0000000000..21c4aef07b
--- /dev/null
+++ b/test/files/run/t5356.check
@@ -0,0 +1,6 @@
+1 scala.runtime.RichInt
+1 scala.runtime.RichInt
+1 scala.math.BigInt
+1 scala.runtime.RichDouble
+1 scala.runtime.RichFloat
+1
diff --git a/test/files/run/t5356.scala b/test/files/run/t5356.scala
new file mode 100644
index 0000000000..f7696c6088
--- /dev/null
+++ b/test/files/run/t5356.scala
@@ -0,0 +1,12 @@
+object Test {
+ def f(x: { def toInt: Int }) = println(x.toInt + " " + x.getClass.getName)
+
+ def main(args: Array[String]): Unit = {
+ f(1)
+ f(1.toInt)
+ f(BigInt(1))
+ f(1d)
+ f(1f)
+ println((1: { def toInt: Int }).toInt)
+ }
+}
diff --git a/test/files/run/treePrint.scala b/test/files/run/treePrint.scala
index 745c2150c2..e0332a705f 100644
--- a/test/files/run/treePrint.scala
+++ b/test/files/run/treePrint.scala
@@ -35,7 +35,7 @@ object Test {
settings.Ycompacttrees.value = true
val intp = new IMain(settings, new PrintWriter(new NullOutputStream))
- val power = Power(intp)
+ val power = new Power(intp, new ReplVals { })
intp.interpret("""def initialize = "Have to interpret something or we get errors." """)
power trees code foreach println
}
diff --git a/test/files/run/type-currying.check b/test/files/run/type-currying.check
new file mode 100644
index 0000000000..e5db238ca5
--- /dev/null
+++ b/test/files/run/type-currying.check
@@ -0,0 +1,27 @@
+Map(abc -> 55)
+(a,0)
+(b,1)
+(c,2)
+(d,3)
+(e,4)
+(f,5)
+(g,6)
+(h,7)
+(i,8)
+(j,9)
+(k,10)
+(l,11)
+(m,12)
+(n,13)
+(o,14)
+(p,15)
+(q,16)
+(r,17)
+(s,18)
+(t,19)
+(u,20)
+(v,21)
+(w,22)
+(x,23)
+(y,24)
+(z,25)
diff --git a/test/files/run/type-currying.scala b/test/files/run/type-currying.scala
new file mode 100644
index 0000000000..f9764c64f0
--- /dev/null
+++ b/test/files/run/type-currying.scala
@@ -0,0 +1,58 @@
+import scala.collection.{ mutable, immutable, generic }
+import generic.CanBuildFrom
+
+object Partial {
+ type KnownContainer[CC[K, V] <: collection.Map[K, V]] = {
+ def values[V] : KnownValues[CC, V]
+ def apply[K] : KnownKeys[CC, K]
+ }
+ type KnownKeys[CC[K, V] <: collection.Map[K, V], K] = {
+ def apply[V](implicit cbf: CanBuildFrom[_, (K, V), CC[K, V]]): CC[K, V]
+ }
+ type KnownValues[CC[K, V] <: collection.Map[K, V], V] = {
+ def apply[K](implicit cbf: CanBuildFrom[_, (K, V), CC[K, V]]): CC[K, V]
+ }
+
+ def apply[CC[K, V] <: collection.Map[K, V]] : KnownContainer[CC] = new {
+ def values[V] : KnownValues[CC, V] = new {
+ def apply[K](implicit cbf: CanBuildFrom[_, (K, V), CC[K, V]]) = cbf().result
+ }
+ def apply[K] = new {
+ def apply[V](implicit cbf: CanBuildFrom[_, (K, V), CC[K, V]]) = cbf().result
+ }
+ }
+}
+
+object Test {
+ val m = Partial[immutable.TreeMap]
+ val m1 = m[String]
+ val m2 = m[Int][Int]
+
+ val mutableBippy = Partial[mutable.HashMap][String][Int]
+ mutableBippy("abc") = 55
+
+ val immutableBippy = Partial[immutable.HashMap].values[Int]
+ def make[T](xs: T*) = immutableBippy[T] ++ xs.zipWithIndex
+
+ val n0 = Partial[immutable.HashMap][String][Int] ++ Seq(("a", 1))
+ val n1 = Partial.apply[immutable.HashMap].apply[String].apply[Int] ++ Seq(("a", 1))
+
+ def main(args: Array[String]): Unit = {
+ println(mutableBippy)
+ make('a' to 'z': _*).toList.sorted foreach println
+ assert(n0 == n1)
+ }
+}
+
+class A {
+ object Foo {
+ def apply[T] = Bar
+ }
+ object Bar {
+ def apply() = Foo
+ }
+
+ def f() = Foo
+ def g = f()[Int]()[String]()
+ def h = Foo[Foo.type]()[Foo.type]()
+}
diff --git a/test/files/run/virtpatmat_literal.scala b/test/files/run/virtpatmat_literal.scala
index cb72b1d2a5..5bd6b30791 100644
--- a/test/files/run/virtpatmat_literal.scala
+++ b/test/files/run/virtpatmat_literal.scala
@@ -1,8 +1,9 @@
object Test extends App {
+ val a = 1
1 match {
case 2 => println("FAILED")
case 1 => println("OK")
- case 1 => println("FAILED")
+ case `a` => println("FAILED")
}
val one = 1
diff --git a/test/files/run/virtpatmat_opt_sharing.check b/test/files/run/virtpatmat_opt_sharing.check
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/test/files/run/virtpatmat_opt_sharing.check
@@ -0,0 +1 @@
+1
diff --git a/test/files/run/virtpatmat_opt_sharing.flags b/test/files/run/virtpatmat_opt_sharing.flags
new file mode 100644
index 0000000000..9769db9257
--- /dev/null
+++ b/test/files/run/virtpatmat_opt_sharing.flags
@@ -0,0 +1 @@
+ -Yvirtpatmat -Xexperimental
diff --git a/test/files/run/virtpatmat_opt_sharing.scala b/test/files/run/virtpatmat_opt_sharing.scala
new file mode 100644
index 0000000000..119e3050ea
--- /dev/null
+++ b/test/files/run/virtpatmat_opt_sharing.scala
@@ -0,0 +1,10 @@
+object Test extends App {
+ virtMatch()
+ def virtMatch() = {
+ List(1, 3, 4, 7) match {
+ case 1 :: 3 :: 4 :: 5 :: x => println("nope")
+ case 1 :: 3 :: 4 :: 6 :: x => println("nope")
+ case 1 :: 3 :: 4 :: 7 :: x => println(1)
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/run/virtpatmat_unapplyprod.check b/test/files/run/virtpatmat_unapplyprod.check
new file mode 100644
index 0000000000..2660ff8f96
--- /dev/null
+++ b/test/files/run/virtpatmat_unapplyprod.check
@@ -0,0 +1,4 @@
+(2,3)
+(2,3)
+(2,3)
+List(true, false, true)
diff --git a/test/files/run/virtpatmat_unapplyprod.flags b/test/files/run/virtpatmat_unapplyprod.flags
new file mode 100644
index 0000000000..9769db9257
--- /dev/null
+++ b/test/files/run/virtpatmat_unapplyprod.flags
@@ -0,0 +1 @@
+ -Yvirtpatmat -Xexperimental
diff --git a/test/files/run/virtpatmat_unapplyprod.scala b/test/files/run/virtpatmat_unapplyprod.scala
new file mode 100644
index 0000000000..441e5e3968
--- /dev/null
+++ b/test/files/run/virtpatmat_unapplyprod.scala
@@ -0,0 +1,23 @@
+object Test extends App {
+ case class Foo(x: Int, y: String)
+
+ Foo(2, "3") match {
+ case Foo(x, y) => println((x, y))
+ }
+
+ case class FooSeq(x: Int, y: String, z: Boolean*)
+
+ FooSeq(2, "3") match {
+ case FooSeq(x, y) => println((x, y))
+ }
+
+ FooSeq(2, "3", true, false, true) match {
+ case FooSeq(x, y) => println("nope")
+ case FooSeq(x, y, true, false, true) => println((x, y))
+ }
+
+ FooSeq(1, "a", true, false, true) match {
+ case FooSeq(1, "a") => println("nope")
+ case FooSeq(1, "a", x@_* ) => println(x.toList)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/xml-attribute.scala b/test/files/run/xml-attribute.scala
new file mode 100644
index 0000000000..8b261acc94
--- /dev/null
+++ b/test/files/run/xml-attribute.scala
@@ -0,0 +1,33 @@
+import xml.Node
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val noAttr = <t/>
+ val attrNull = <t a={ null: String }/>
+ val attrNone = <t a={ None: Option[Seq[Node]] }/>
+ val preAttrNull = <t p:a={ null: String }/>
+ val preAttrNone = <t p:a={ None: Option[Seq[Node]] }/>
+ assert(noAttr == attrNull)
+ assert(noAttr == attrNone)
+ assert(noAttr == preAttrNull)
+ assert(noAttr == preAttrNone)
+
+ val noAttrStr = "<t></t>"
+ assert(noAttr.toString() == noAttrStr)
+ assert(attrNull.toString() == noAttrStr)
+ assert(attrNone.toString() == noAttrStr)
+ assert(preAttrNull.toString() == noAttrStr)
+ assert(preAttrNone.toString() == noAttrStr)
+
+ val xml1 = <t b="1" d="2"/>
+ val xml2 = <t a={ null: String } p:a={ null: String } b="1" c={ null: String } d="2"/>
+ val xml3 = <t b="1" c={ null: String } d="2" a={ null: String } p:a={ null: String }/>
+ assert(xml1 == xml2)
+ assert(xml1 == xml3)
+
+ val xml1Str = "<t d=\"2\" b=\"1\"></t>"
+ assert(xml1.toString() == xml1Str)
+ assert(xml2.toString() == xml1Str)
+ assert(xml3.toString() == xml1Str)
+ }
+}