mirror of
https://github.com/flynx/serialize.js.git
synced 2026-07-10 19:20:56 +00:00
cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
cafd30bad2
commit
6fca53562b
21
test.js
21
test.js
@ -170,7 +170,6 @@ test.Tests({
|
|||||||
// XXX
|
// XXX
|
||||||
},
|
},
|
||||||
|
|
||||||
//* XXX ERR
|
|
||||||
'partial-deep-copy': function(assert, [setup]){
|
'partial-deep-copy': function(assert, [setup]){
|
||||||
var obj = eJSON.deserialize(setup, true)
|
var obj = eJSON.deserialize(setup, true)
|
||||||
var funcs = []
|
var funcs = []
|
||||||
@ -232,20 +231,32 @@ test.Cases({
|
|||||||
var obj = this._make_object_with_methods()
|
var obj = this._make_object_with_methods()
|
||||||
var obj_copy = eJSON.deepCopy(obj, true)
|
var obj_copy = eJSON.deepCopy(obj, true)
|
||||||
|
|
||||||
|
// sanity checks...
|
||||||
assert(obj.stateless() == 'stateless')
|
assert(obj.stateless() == 'stateless')
|
||||||
assert(obj.stateful() == 'state_retained')
|
assert(obj.stateful() == 'state_retained')
|
||||||
|
|
||||||
assert(obj_copy.stateless() == 'stateless')
|
assert(obj_copy.stateless() == 'stateless')
|
||||||
assert(obj_copy.stateful() == 'state_lost') },
|
|
||||||
|
// context should be lost...
|
||||||
|
assert(
|
||||||
|
obj_copy.stateful() == 'state_lost',
|
||||||
|
'Function closure not lost.')
|
||||||
|
assert(obj.stateful !== obj_copy.stateful,
|
||||||
|
'Function objects retained.') },
|
||||||
'partial-deep-copy-function': function(assert){
|
'partial-deep-copy-function': function(assert){
|
||||||
var obj = this._make_object_with_methods()
|
var obj = this._make_object_with_methods()
|
||||||
var obj_copy = eJSON.partialDeepCopy(obj)
|
var obj_copy = eJSON.partialDeepCopy(obj)
|
||||||
|
|
||||||
|
// sanity checks...
|
||||||
assert(obj.stateless() == 'stateless')
|
assert(obj.stateless() == 'stateless')
|
||||||
assert(obj.stateful() == 'state_retained')
|
assert(obj.stateful() == 'state_retained')
|
||||||
|
|
||||||
assert(obj_copy.stateless() == 'stateless')
|
assert(obj_copy.stateless() == 'stateless')
|
||||||
assert(obj_copy.stateful() == 'state_retained') },
|
|
||||||
|
// context should be retained...
|
||||||
|
assert(
|
||||||
|
obj_copy.stateful() == 'state_retained',
|
||||||
|
'Function closure lost.')
|
||||||
|
assert(obj.stateful === obj_copy.stateful,
|
||||||
|
'Function objects not retained.') },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user