mirror of
https://github.com/alibaba/fastjson.git
synced 2026-10-29 06:06:50 +08:00
Merge pull request #139 from pepov/master
Fix number parsing in objects
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user