diff --git a/jvm/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala index 5d90054c7..9ae6bc389 100644 --- a/jvm/src/test/scala/scala/xml/XMLTest.scala +++ b/jvm/src/test/scala/scala/xml/XMLTest.scala @@ -390,7 +390,7 @@ class XMLTestJVM { } @UnitTest - def t5052 { + def t5052 = { assertTrue( xml_== ) assertTrue( xml_== ) assertTrue( xml_== ) @@ -412,7 +412,7 @@ class XMLTestJVM { } @UnitTest - def t5843 { + def t5843 = { val foo = scala.xml.Attribute(null, "foo", "1", scala.xml.Null) val bar = scala.xml.Attribute(null, "bar", "2", foo) val ns = scala.xml.NamespaceBinding(null, "uri", scala.xml.TopScope) @@ -444,7 +444,7 @@ class XMLTestJVM { } @UnitTest - def t7074 { + def t7074 = { assertEquals("""""", sort() toString) assertEquals("""""", sort() toString) assertEquals("""""", sort() toString) @@ -456,6 +456,12 @@ class XMLTestJVM { assertEquals("""""", sort() toString) } + @UnitTest + def t9060 = { + val expected = """""" + assertEquals(expected, XML.loadString(expected).toString) + } + @UnitTest def attributes = { val noAttr = diff --git a/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala b/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala new file mode 100644 index 000000000..d67524c51 --- /dev/null +++ b/jvm/src/test/scala/scala/xml/parsing/ConstructingParserTest.scala @@ -0,0 +1,22 @@ +package scala.xml +package parsing + +import scala.io.Source +import org.junit.Test +import scala.xml.JUnitAssertsForXML.{ assertEquals => assertXml } + +class ConstructingParserTest { + + @Test + def t9060 = { + val a = """""" + val source = new Source { + val iter = a.iterator + override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err) = {} + } + val doc = ConstructingParser.fromSource(source, false).content(TopScope) + assertXml(a, doc) + + } + +} diff --git a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala index ab71a43c0..32149bd14 100644 --- a/shared/src/main/scala/scala/xml/parsing/TokenTests.scala +++ b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala @@ -37,10 +37,10 @@ trait TokenTests { /** * {{{ - * NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' + * NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | #xB7 * | CombiningChar | Extender * }}} - * See [4] and Appendix B of XML 1.0 specification. + * See [4] and [4a] of Appendix B of XML 1.0 specification. */ def isNameChar(ch: Char) = { import java.lang.Character._ @@ -50,19 +50,19 @@ trait TokenTests { case COMBINING_SPACING_MARK | ENCLOSING_MARK | NON_SPACING_MARK | MODIFIER_LETTER | DECIMAL_DIGIT_NUMBER => true - case _ => ".-:" contains ch + case _ => ".-:·" contains ch }) } /** * {{{ - * NameStart ::= ( Letter | '_' ) + * NameStart ::= ( Letter | '_' | ':' ) * }}} * where Letter means in one of the Unicode general * categories `{ Ll, Lu, Lo, Lt, Nl }`. * * We do not allow a name to start with `:`. - * See [3] and Appendix B of XML 1.0 specification + * See [4] and Appendix B of XML 1.0 specification */ def isNameStart(ch: Char) = { import java.lang.Character._ @@ -71,7 +71,7 @@ trait TokenTests { case LOWERCASE_LETTER | UPPERCASE_LETTER | OTHER_LETTER | TITLECASE_LETTER | LETTER_NUMBER => true - case _ => ch == '_' + case _ => ":_".contains(ch) } } diff --git a/shared/src/test/scala/scala/xml/UtilityTest.scala b/shared/src/test/scala/scala/xml/UtilityTest.scala index 58aadf780..5c7d39496 100644 --- a/shared/src/test/scala/scala/xml/UtilityTest.scala +++ b/shared/src/test/scala/scala/xml/UtilityTest.scala @@ -2,7 +2,6 @@ package scala.xml import org.junit.Test import org.junit.Assert.assertTrue -import org.junit.Assert.assertFalse import org.junit.Assert.assertEquals class UtilityTest { @@ -10,7 +9,7 @@ class UtilityTest { @Test def isNameStart: Unit = { assertTrue(Utility.isNameStart('b')) - assertFalse(Utility.isNameStart(':')) + assertTrue(Utility.isNameStart(':')) } @Test