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 9de9d57
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions tests/pos/i16458.scala → tests/run/i16458.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
def x = <div>FooBar</div><!-- /.modal-content -->

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
)
}
}

package scala.xml {
type MetaData = AnyRef
Expand All @@ -16,7 +33,7 @@ package scala.xml {
def child = Nil
}
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 9de9d57

Please sign in to comment.