From b74cf5118ee4670821588b72d83a468be10e4982 Mon Sep 17 00:00:00 2001 From: "Aaron S. Hawley" Date: Mon, 14 Sep 2015 13:51:31 -0400 Subject: [PATCH] Use NodeSeq.fromSeq instead of new NodeSeq { val theSeq = ... } --- src/main/scala/scala/xml/parsing/MarkupParser.scala | 2 +- src/test/scala/scala/xml/PatternMatching.scala | 4 ++-- src/test/scala/scala/xml/XMLTest.scala | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/scala/scala/xml/parsing/MarkupParser.scala b/src/main/scala/scala/xml/parsing/MarkupParser.scala index 612cc88e3..04e665023 100755 --- a/src/main/scala/scala/xml/parsing/MarkupParser.scala +++ b/src/main/scala/scala/xml/parsing/MarkupParser.scala @@ -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 diff --git a/src/test/scala/scala/xml/PatternMatching.scala b/src/test/scala/scala/xml/PatternMatching.scala index 05ec06268..c9d7c7e10 100644 --- a/src/test/scala/scala/xml/PatternMatching.scala +++ b/src/test/scala/scala/xml/PatternMatching.scala @@ -74,7 +74,7 @@ class PatternMatching extends { Baaaaaaalabla ; - assertTrue(new NodeSeq { val theSeq = books.child } match { + assertTrue(NodeSeq.fromSeq(books.child) match { case t @ Seq(Blabla) => false case _ => true }) @@ -110,4 +110,4 @@ class PatternMatching extends { case (ser: Serializable, "foo") => false }) } -} \ No newline at end of file +} diff --git a/src/test/scala/scala/xml/XMLTest.scala b/src/test/scala/scala/xml/XMLTest.scala index 6ab741390..57ebf2b68 100644 --- a/src/test/scala/scala/xml/XMLTest.scala +++ b/src/test/scala/scala/xml/XMLTest.scala @@ -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")) } @@ -94,7 +94,7 @@ class XMLTest { assertEquals(results1Expected, results1) { - val actual = for (t @ Blabla <- new NodeSeq { val theSeq = books.child }.toList) + val actual = for (t @ Blabla <- NodeSeq.fromSeq(books.child).toList) yield t val expected = List(Blabla) assertEquals(expected, actual) @@ -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")),