mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-07 19:14:15 +08:00
non-number numbers
This commit is contained in:
10
Test.java
10
Test.java
@@ -40,7 +40,7 @@ SOFTWARE.
|
||||
* comparisons of .toString to a string literal are likely to fail.
|
||||
*
|
||||
* @author JSON.org
|
||||
* @version 2011-10-05
|
||||
* @version 2011-10-16
|
||||
*/
|
||||
public class Test extends TestCase {
|
||||
public Test(String name) {
|
||||
@@ -67,6 +67,10 @@ public class Test extends TestCase {
|
||||
jsonobject = XML.toJSONObject(string);
|
||||
assertEquals("{\"test\": {\n \"blank\": \"\",\n \"empty\": \"\"\n}}", jsonobject.toString(2));
|
||||
assertEquals("<test><blank/><empty/></test>", XML.toString(jsonobject));
|
||||
|
||||
string = "<subsonic-response><playlists><playlist id=\"476c65652e6d3375\"/><playlist id=\"50617274792e78737066\"/></playlists></subsonic-response>";
|
||||
jsonobject = XML.toJSONObject(string);
|
||||
assertEquals("{\"subsonic-response\":\"playlists\":{\"playlist\":[{\"id\":\"476c65652e6d337\"},\"id\":\"50617274792e78737066\"}]}}}", jsonobject.toString());
|
||||
}
|
||||
|
||||
public void testNull() throws Exception {
|
||||
@@ -95,6 +99,10 @@ public class Test extends TestCase {
|
||||
jsonarray = new JSONArray(string);
|
||||
assertEquals("[1122334455]", jsonarray.toString());
|
||||
|
||||
string = "[666e666]";
|
||||
jsonarray = new JSONArray(string);
|
||||
assertEquals("[\"666e666\"]", jsonarray.toString());
|
||||
|
||||
string = "[00.10]";
|
||||
jsonarray = new JSONArray(string);
|
||||
assertEquals("[0.1]", jsonarray.toString());
|
||||
|
Reference in New Issue
Block a user