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