-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR-URL: metarhia/jstp#237 Reviewed-By: Mykola Bilochub <nbelochub@gmail.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
- Loading branch information
Showing
7 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
'use strict'; | ||
|
||
module.exports = [].concat( | ||
require('./number'), | ||
require('./string'), | ||
require('./array'), | ||
require('./object') | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict'; | ||
|
||
module.exports = [ | ||
{ | ||
name: 'NaN', | ||
value: NaN, | ||
serialized: 'NaN' | ||
}, | ||
{ | ||
name: 'Infinity', | ||
value: Infinity, | ||
serialized: 'Infinity' | ||
}, | ||
{ | ||
name: '-Infinity', | ||
value: -Infinity, | ||
serialized: '-Infinity' | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict'; | ||
|
||
module.exports = [ | ||
{ | ||
name: 'string containing inline comment', | ||
value: '// inline comment', | ||
serialized: '\'// inline comment\'' | ||
}, | ||
{ | ||
name: 'string containing block comment', | ||
value: '/* block comment */', | ||
serialized: '\'/* block comment */\'' | ||
}, | ||
{ | ||
name: 'string with number inside', | ||
value: '0.5', | ||
serialized: '\'0.5\'' | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
module.exports = [].concat( | ||
require('./object') | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict'; | ||
|
||
module.exports = [ | ||
{ | ||
name: 'object with numeric literal as key', | ||
value: { 42: true }, | ||
serialized: '{42:true}' | ||
}, | ||
{ | ||
name: 'object with identifier names as keys', | ||
value: { $: 'dollar', _$_: 'multiple symbols' }, | ||
serialized: '{$:\'dollar\',_$_:\'multiple symbols\'}' | ||
}, | ||
{ | ||
name: 'object with identifier name, ' + | ||
'containing non-latin Unicode literals, as a key', | ||
value: { ümlåût: 'that\'s not really an ümlaüt, but this is' }, | ||
serialized: '{ümlåût: \'that\\\'s not really an ümlaüt, but this is\'}' | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
const jstp = require('../..'); | ||
|
||
const test = require('tap').test; | ||
const testCases = require('../fixtures/todo/serde/serialization'); | ||
|
||
testCases.forEach((testCase) => { | ||
test(`must serialize ${testCase.name}`, (test) => { | ||
test.strictSame(jstp.stringify(testCase.value), testCase.serialized); | ||
test.end(); | ||
}); | ||
}); |