Skip to content

Commit

Permalink
Compare if and only if both side of BinaryExpression is captured (or …
Browse files Browse the repository at this point in the history
…literal).
  • Loading branch information
twada committed May 12, 2014
1 parent 02f2e8c commit 96ae4c1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/power-assert-formatter.js
Expand Up @@ -210,6 +210,11 @@
value: esNode.value()
};
espathToPair[esNode.espath] = pair;
}
});
Object.keys(espathToPair).forEach(function (espath) {
var pair = espathToPair[espath];
if (pair.left && pair.right) {
pairs.push(pair);
}
});
Expand Down
14 changes: 14 additions & 0 deletions test/power_assert_formatter_test.js
Expand Up @@ -1685,6 +1685,20 @@ suite('power-assert-formatter', function () {
]);
});

test('Function object equality', function () {
assertPowerAssertContextFormatting(function () {
eval(weave('assert(function(x,y){ return x + y; } == new Function("x", "y", "return x + y"));'));
}, [
'# /path/to/some_test.js:1',
'',
'assert(function (x, y) {return x + y;} == new Function("x", "y", "return x + y"))',
' | | ',
' | #function# ',
' false ',
''
]);
});

});


Expand Down

0 comments on commit 96ae4c1

Please sign in to comment.