mirror of
https://github.com/flynx/serialize.js.git
synced 2026-07-10 11:10:57 +00:00
better testing + bugfix...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
0feee69ee9
commit
047d80f792
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-serialize",
|
||||
"version": "1.0.5",
|
||||
"version": "1.0.6",
|
||||
"description": "experimental extended json serializaion...",
|
||||
"main": "serialize.js",
|
||||
"scripts": {
|
||||
|
||||
@ -413,7 +413,7 @@ module.eJSON = {
|
||||
var mode = 'dec'
|
||||
if(str[j] == '0'
|
||||
&& 'xXbBoO'.includes(str[j+1])){
|
||||
mode = str[j+1]
|
||||
mode = str[j+1].toLowerCase()
|
||||
j++ }
|
||||
j++
|
||||
while(j < str.length
|
||||
@ -432,6 +432,7 @@ module.eJSON = {
|
||||
// exponent...
|
||||
|| str[j] == 'e'
|
||||
|| str[j] == 'E')){
|
||||
// exponent sign...
|
||||
if('eE'.includes(str[j])
|
||||
&& '+-'.includes(str[j+1])){
|
||||
j++ }
|
||||
|
||||
9
test.js
9
test.js
@ -49,6 +49,8 @@ var setups = test.Setups({
|
||||
// return ['+123', json] },
|
||||
'number-exp': function(assert){
|
||||
return ['1e+100', json] },
|
||||
'number-exp-neg': function(assert){
|
||||
return ['1e-100', json] },
|
||||
'number-zero': function(assert){
|
||||
return ['0', json] },
|
||||
'float-a': function(assert){
|
||||
@ -204,9 +206,16 @@ test.Cases({
|
||||
['123.', '123'],
|
||||
['+123', '123'],
|
||||
['123e100', '123e+100'],
|
||||
['123E100', '123e+100'],
|
||||
['0xff', '255'],
|
||||
['0Xff', '255'],
|
||||
['0o77', '63'],
|
||||
['0O77', '63'],
|
||||
['0b11', '3'],
|
||||
['0B11', '3'],
|
||||
|
||||
// string quotes...
|
||||
// XXX test new lines...
|
||||
["'abc'", '"abc"'],
|
||||
['`abc`', '"abc"'],
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user