diff options
author | Burak Emir <emir@epfl.ch> | 2005-12-12 10:27:27 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2005-12-12 10:27:27 +0000 |
commit | 5dbdf2cc8cb2b96271b1a8183319592f239173f6 (patch) | |
tree | 52cb3bc16ae79b99a9b9c5dd0bd0dd04a33c1b51 /test | |
parent | 04fe66b3066a95dadd22e3ebdf3d6a6aafe6e623 (diff) | |
download | scala-5dbdf2cc8cb2b96271b1a8183319592f239173f6.tar.gz scala-5dbdf2cc8cb2b96271b1a8183319592f239173f6.tar.bz2 scala-5dbdf2cc8cb2b96271b1a8183319592f239173f6.zip |
changed test cases for anyvalue attributes
Diffstat (limited to 'test')
-rw-r--r-- | test/files/jvm/xml01.check | 3 | ||||
-rw-r--r-- | test/files/jvm/xml01.scala | 23 | ||||
-rw-r--r-- | test/files/jvm/xmlstuff.scala | 2 |
3 files changed, 26 insertions, 2 deletions
diff --git a/test/files/jvm/xml01.check b/test/files/jvm/xml01.check index 34ce38f67e..dd05157794 100644 --- a/test/files/jvm/xml01.check +++ b/test/files/jvm/xml01.check @@ -19,3 +19,6 @@ passed ok passed ok passed ok <book><author>Peter Buneman</author><author>Dan Suciu</author><title>Data on ze web</title></book> +attribute value normalization +passed ok +passed ok diff --git a/test/files/jvm/xml01.scala b/test/files/jvm/xml01.scala index a0ea59408c..1e54ae9e19 100644 --- a/test/files/jvm/xml01.scala +++ b/test/files/jvm/xml01.scala @@ -177,7 +177,28 @@ object Test { Console.println( (parsedxml2 \\ "book" ){ n:Node => n \ "title" == "Data on ze web" } - ) + ); + + // test unicode escapes backslash u + + Console println ("attribute value normalization"); + val xmlAttrValueNorm = "<personne id='p0003' nom='Şahingöz' />"; + { + val isrcA = new InputSource( new StringReader(xmlAttrValueNorm) ); + val parsedxmlA = XML.load(isrcA); + val c = (parsedxmlA \ "@nom").text.charAt(0); + //Console.println("char '"+c+"' \u015e"); + assertTrue(c == '\u015e'); + } + { + val isr = scala.io.Source.fromString(xmlAttrValueNorm); + val pxmlB = scala.xml.parsing.ConstructingParser.fromSource(isr,false); + val parsedxmlB = pxmlB.element(TopScope); + val c = (parsedxmlB \ "@nom").text.charAt(0); + //Console.println("char '"+c+"' \u015e"); + assertTrue(c == '\u015e'); + } + } diff --git a/test/files/jvm/xmlstuff.scala b/test/files/jvm/xmlstuff.scala index e9db999828..68e207c370 100644 --- a/test/files/jvm/xmlstuff.scala +++ b/test/files/jvm/xmlstuff.scala @@ -47,7 +47,7 @@ object Test { </foo>; val pelems_1 = for( val x <- p \ "bar"; val y <- p \ "baz" ) yield { - Text(x.attribute("value") + y.attribute("bazValue")+ "!") + Text(x.attribute("value").toString() + y.attribute("bazValue").toString()+ "!") }; val pelems_2 = new NodeSeq { val theSeq = List(Text("38!"),Text("58!")) }; assertSameElements(pelems_1, pelems_2); |