circular.js 451 B

12345678910111213141516
  1. var inspect = require('../');
  2. var test = require('tape');
  3. test('circular', function (t) {
  4. t.plan(2);
  5. var obj = { a: 1, b: [3, 4] };
  6. obj.c = obj;
  7. t.equal(inspect(obj), '{ a: 1, b: [ 3, 4 ], c: [Circular] }');
  8. var double = {};
  9. double.a = [double];
  10. double.b = {};
  11. double.b.inner = double.b;
  12. double.b.obj = double;
  13. t.equal(inspect(double), '{ a: [ [Circular] ], b: { inner: [Circular], obj: [Circular] } }');
  14. });