tweaks...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2021-05-22 12:37:56 +03:00
parent 2b6442088c
commit c5601945c4
2 changed files with 24 additions and 4 deletions

View File

@ -328,8 +328,7 @@ var LogicTypePrototype = {
if(arguments.length < 3 || !(cmp instanceof Function)){
return Diff.cmp(
cmp instanceof Function ? this : this.context(cmp),
obj)
}
obj) }
/*
cmp = cmp || function(a, b){

25
test.js
View File

@ -69,11 +69,32 @@ test.Tests({
test.Cases({
'basics': function(assert){
// XXX move reference objects + expected diffs to setups
a = {}
b = {}
var a = {}
var b = {}
assert(diff.Diff(a, b), 'Diff(..)')
},
recursion: function(assert){
var a = {}
a.x = a
var b = {}
b.x = b
assert(diff.cmp(a, b), 'recursive cmp(..)')
a = {}
a.x = a
b = {}
b.y = b
assert(!diff.cmp(a, b), 'recursive !cmp(..)')
a = {}
a.x = a
b = {x: {}}
assert(!diff.cmp(a, b), 'recursive cmp(..)')
},
})