better testing + bugfix...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2026-01-11 04:47:53 +03:00
parent 0feee69ee9
commit 047d80f792
3 changed files with 12 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "ig-serialize",
"version": "1.0.5",
"version": "1.0.6",
"description": "experimental extended json serializaion...",
"main": "serialize.js",
"scripts": {

View File

@ -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++ }

View File

@ -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"'],