mirror of
https://github.com/flynx/serialize.js.git
synced 2026-07-10 11:10:57 +00:00
better tests...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
5e2c466f51
commit
cafd30bad2
30
test.js
30
test.js
@ -218,12 +218,34 @@ test.Cases({
|
||||
`"${ a }" and "${ b }" should deserialize to the samve value.`,
|
||||
'got:', aa, 'and', bb, 'resp.') } },
|
||||
|
||||
_make_object_with_methods: function(){
|
||||
var in_closure = 123
|
||||
return {
|
||||
stateful: function(){
|
||||
return typeof(in_closure) != 'undefined' ?
|
||||
'state_retained'
|
||||
: 'state_lost' },
|
||||
stateless: function(){
|
||||
return 'stateless' },
|
||||
} },
|
||||
'deep-copy-function': function(assert){
|
||||
// XXX check function isolation...
|
||||
},
|
||||
var obj = this._make_object_with_methods()
|
||||
var obj_copy = eJSON.deepCopy(obj, true)
|
||||
|
||||
assert(obj.stateless() == 'stateless')
|
||||
assert(obj.stateful() == 'state_retained')
|
||||
|
||||
assert(obj_copy.stateless() == 'stateless')
|
||||
assert(obj_copy.stateful() == 'state_lost') },
|
||||
'partial-deep-copy-function': function(assert){
|
||||
// XXX check function isolation...
|
||||
},
|
||||
var obj = this._make_object_with_methods()
|
||||
var obj_copy = eJSON.partialDeepCopy(obj)
|
||||
|
||||
assert(obj.stateless() == 'stateless')
|
||||
assert(obj.stateful() == 'state_retained')
|
||||
|
||||
assert(obj_copy.stateless() == 'stateless')
|
||||
assert(obj_copy.stateful() == 'state_retained') },
|
||||
})
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user