Skip to content

Commit

Permalink
tidy: use run test instead of compile test
Browse files Browse the repository at this point in the history
To check parsing properly, it is better to run a test and assert parse
result.
  • Loading branch information
i10416 committed Jan 24, 2024
1 parent 27046fe commit 788fc43
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions tests/pos/i16458.scala → tests/run/i16458.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@

object Test {
import scala.xml.*
def main(args: Array[String]): Unit = {
val xml = <div>FooBar</div><!-- /.modal-content -->
assert(
xml match
case Seq(elm: Elem, comment: Comment) if
elm.label == "div" &&
elm.child(0) == Atom(Text("FooBar")) &&
comment.label == " /.modal-content "
=> true
case _ => false
,
xml
)
}
}

def x = <div>FooBar</div><!-- /.modal-content -->

package scala.xml {
Expand All @@ -14,9 +33,14 @@ package scala.xml {
class Comment(commentText: String) extends Node{
def label = commentText
def child = Nil
override def toString = s"$label,$child,$commentText"
}
class Elem(prefix: String, val label: String, attributes1: MetaData, scope: NamespaceBinding, minimizeEmpty: Boolean, val child: Node*) extends Node {
override def toString =
s"${prefix},${label},${child},${attributes1},${minimizeEmpty},${scope}"

}
class Elem(prefix: String, val label: String, attributes1: MetaData, scope: NamespaceBinding, minimizeEmpty: Boolean, val child: Node*) extends Node
class NodeBuffer extends Seq[Node] {
class NodeBuffer extends Seq[Node] {
val nodes = scala.collection.mutable.ArrayBuffer.empty[Node]
def &+(o: Any): NodeBuffer =
o match {
Expand Down

0 comments on commit 788fc43

Please sign in to comment.