corrade-nucleus-nucleons – Blame information for rev 20
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | var test = require('tap').test |
2 | var sigmund = require('../sigmund.js') |
||
3 | |||
4 | |||
5 | // occasionally there are duplicates |
||
6 | // that's an acceptable edge-case. JSON.stringify and util.inspect |
||
7 | // have some collision potential as well, though less, and collision |
||
8 | // detection is expensive. |
||
9 | var hash = '{abc/def/g{0h1i2{jkl' |
||
10 | var obj1 = {a:'b',c:/def/,g:['h','i',{j:'',k:'l'}]} |
||
11 | var obj2 = {a:'b',c:'/def/',g:['h','i','{jkl']} |
||
12 | |||
13 | var obj3 = JSON.parse(JSON.stringify(obj1)) |
||
14 | obj3.c = /def/ |
||
15 | obj3.g[2].cycle = obj3 |
||
16 | var cycleHash = '{abc/def/g{0h1i2{jklcycle' |
||
17 | |||
18 | test('basic', function (t) { |
||
19 | t.equal(sigmund(obj1), hash) |
||
20 | t.equal(sigmund(obj2), hash) |
||
21 | t.equal(sigmund(obj3), cycleHash) |
||
22 | t.end() |
||
23 | }) |
||
24 |