Merge pull request #139 from pepov/master

Fix number parsing in objects
This commit is contained in:
高铁
2014-09-30 04:26:42 +08:00
5 changed files with 15 additions and 1 deletions
@@ -16,6 +16,7 @@
package com.alibaba.json.bvt;
import java.util.HashMap;
import java.util.Map;
import org.junit.Assert;
import junit.framework.TestCase;
@@ -34,6 +35,14 @@ public class DefaultJSONParserTest extends TestCase {
Assert.assertEquals(3.4D, result);
}
public void test_double_in_object() {
DefaultJSONParser parser = new DefaultJSONParser("{\"double\":3.4}");
parser.config(Feature.UseBigDecimal, false);
Assert.assertEquals("{\"double\":3.4}", parser.getInput());
Object result = parser.parse();
Assert.assertEquals(3.4D, ((Map) result).get("double"));
}
public void test_error() {
Exception error = null;
try {