diff --git a/ecmascript-testcases/test-bug-json-parse-posexpt.js b/ecmascript-testcases/test-bug-json-parse-posexpt.js new file mode 100644 index 00000000..dc5b737d --- /dev/null +++ b/ecmascript-testcases/test-bug-json-parse-posexpt.js @@ -0,0 +1,30 @@ +/* + * JSON number parsing bug in Duktape 1.0 for explicitly positive exponents, + * eval() works. + */ + +/*=== +150 +150 +===*/ + +function testJson() { + // The parse error here is caused by the exponent plus sign. + print(JSON.parse('1.50e+2')); +} + +function testEval() { + print(eval('1.50e+2')); +} + +try { + testJson(); +} catch (e) { + print(e.stack || e); +} + +try { + testEval(); +} catch (e) { + print(e.stack || e); +}