mirror of
https://github.com/flynx/diff.js.git
synced 2025-10-28 10:30:09 +00:00
tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
2b6442088c
commit
c5601945c4
3
diff.js
3
diff.js
@ -328,8 +328,7 @@ var LogicTypePrototype = {
|
|||||||
if(arguments.length < 3 || !(cmp instanceof Function)){
|
if(arguments.length < 3 || !(cmp instanceof Function)){
|
||||||
return Diff.cmp(
|
return Diff.cmp(
|
||||||
cmp instanceof Function ? this : this.context(cmp),
|
cmp instanceof Function ? this : this.context(cmp),
|
||||||
obj)
|
obj) }
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
cmp = cmp || function(a, b){
|
cmp = cmp || function(a, b){
|
||||||
|
|||||||
25
test.js
25
test.js
@ -69,11 +69,32 @@ test.Tests({
|
|||||||
test.Cases({
|
test.Cases({
|
||||||
'basics': function(assert){
|
'basics': function(assert){
|
||||||
// XXX move reference objects + expected diffs to setups
|
// XXX move reference objects + expected diffs to setups
|
||||||
a = {}
|
var a = {}
|
||||||
b = {}
|
var b = {}
|
||||||
|
|
||||||
assert(diff.Diff(a, b), 'Diff(..)')
|
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(..)')
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user