1
0
Fork 0
mirror of https://github.com/ethauvin/JSON-java.git synced 2025-06-18 00:10:51 -07:00

Adds testing for unicode entities

This commit is contained in:
John J. Aylward 2017-08-19 18:45:53 -04:00
parent cb61bbf720
commit 2713f2e2a4

View file

@ -782,11 +782,20 @@ public class XMLTest {
XML.toJSONObject("<xml>Can cope &amp;; </xml>").toString()); XML.toJSONObject("<xml>Can cope &amp;; </xml>").toString());
assertEquals("Can cope &; ", XML.unescape("Can cope &amp;; ")); assertEquals("Can cope &; ", XML.unescape("Can cope &amp;; "));
// unicode entity
assertEquals("{\"xml\":\"Can cope 4;\"}",
XML.toJSONObject("<xml>Can cope &#x34;; </xml>").toString());
assertEquals("Can cope 4; ", XML.unescape("Can cope &#x34;; "));
// double escaped // double escaped
assertEquals("{\"xml\":\"Can cope &lt;\"}", assertEquals("{\"xml\":\"Can cope &lt;\"}",
XML.toJSONObject("<xml>Can cope &amp;lt; </xml>").toString()); XML.toJSONObject("<xml>Can cope &amp;lt; </xml>").toString());
assertEquals("Can cope &lt; ", XML.unescape("Can cope &amp;lt; ")); assertEquals("Can cope &lt; ", XML.unescape("Can cope &amp;lt; "));
} assertEquals("{\"xml\":\"Can cope &#x34;\"}",
XML.toJSONObject("<xml>Can cope &amp;#x34; </xml>").toString());
assertEquals("Can cope &#x34; ", XML.unescape("Can cope &amp;#x34; "));
}
} }