Skip to content

Use NodeSeq.fromSeq instead of new NodeSeq { val theSeq = ... } #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/scala/scala/xml/parsing/MarkupParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests {
val ts = new NodeBuffer
var exit = eof
// todo: optimize seq repr.
def done = new NodeSeq { val theSeq = ts.toList }
def done = NodeSeq.fromSeq(ts.toList)

while (!exit) {
tmppos = pos
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/scala/xml/PatternMatching.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class PatternMatching extends {
<title>Baaaaaaalabla</title>
</bks>;

assertTrue(new NodeSeq { val theSeq = books.child } match {
assertTrue(NodeSeq.fromSeq(books.child) match {
case t @ Seq(<title>Blabla</title>) => false
case _ => true
})
Expand Down Expand Up @@ -110,4 +110,4 @@ class PatternMatching extends {
case (ser: Serializable, "foo") => false
})
}
}
}
6 changes: 3 additions & 3 deletions src/test/scala/scala/xml/XMLTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class XMLTest {
Text(x.attributes("value").toString + y.attributes("bazValue").toString + "!")
};

val pelems_2 = new NodeSeq { val theSeq = List(Text("38!"), Text("58!")) };
val pelems_2 = NodeSeq.fromSeq(List(Text("38!"), Text("58!")));
assertTrue(pelems_1 sameElements pelems_2)
assertTrue(Text("8") sameElements (p \\ "@bazValue"))
}
Expand Down Expand Up @@ -94,7 +94,7 @@ class XMLTest {
assertEquals(results1Expected, results1)

{
val actual = for (t @ <book><title>Blabla</title></book> <- new NodeSeq { val theSeq = books.child }.toList)
val actual = for (t @ <book><title>Blabla</title></book> <- NodeSeq.fromSeq(books.child).toList)
yield t
val expected = List(<book><title>Blabla</title></book>)
assertEquals(expected, actual)
Expand Down Expand Up @@ -312,7 +312,7 @@ class XMLTest {
(parsedxml2 \\ "book") { n: Node => (n \ "title") xml_== "Data on ze web" } toString)

assertTrue(
((new NodeSeq { val theSeq = List(parsedxml2) }) \\ "_") sameElements List(
((NodeSeq.fromSeq(List(parsedxml2))) \\ "_") sameElements List(
Elem(null, "bib", e, sc,
Elem(null, "book", e, sc,
Elem(null, "author", e, sc, Text("Peter Buneman")),
Expand Down