1
0
Fork 0
mirror of https://github.com/ethauvin/JSON-java.git synced 2025-06-17 16:00:51 -07:00
This commit is contained in:
Douglas Crockford 2011-10-05 12:30:20 -07:00
parent 90e62b0e1b
commit 3e3951f125

View file

@ -40,7 +40,7 @@ SOFTWARE.
* comparisons of .toString to a string literal are likely to fail. * comparisons of .toString to a string literal are likely to fail.
* *
* @author JSON.org * @author JSON.org
* @version 2011-10-03 * @version 2011-10-05
*/ */
public class Test extends TestCase { public class Test extends TestCase {
public Test(String name) { public Test(String name) {
@ -81,7 +81,7 @@ public class Test extends TestCase {
} }
public void testJSON() throws Exception { public void testJSON() throws Exception {
double eps = 2.220446049250313e-16; double eps = 2.220446049250313e-16;
Iterator iterator; Iterator iterator;
JSONArray jsonarray; JSONArray jsonarray;
JSONObject jsonobject; JSONObject jsonobject;
@ -838,6 +838,15 @@ public class Test extends TestCase {
assertEquals("Mismatched 'right' and 'wrong' at 15 [character 16 line 1]", jsone.getMessage()); assertEquals("Mismatched 'right' and 'wrong' at 15 [character 16 line 1]", jsone.getMessage());
} }
try {
string = "This ain't XML.";
jsonarray = JSONML.toJSONArray(string);
System.out.println(jsonarray.toString(4));
fail("expecting JSONException here.");
} catch (JSONException jsone) {
assertEquals("Bad XML at 17 [character 18 line 1]", jsone.getMessage());
}
try { try {
string = "{\"koda\": true, \"koda\": true}"; string = "{\"koda\": true, \"koda\": true}";
jsonobject = new JSONObject(string); jsonobject = new JSONObject(string);