Skip to content

Commit 01ac3e4

Browse files
committed
[Tests] add passing tests
1 parent 6ab8faa commit 01ac3e4

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

test/circular.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@ var inspect = require('../');
22
var test = require('tape');
33

44
test('circular', function (t) {
5-
t.plan(1);
5+
t.plan(2);
66
var obj = { a: 1, b: [3, 4] };
77
obj.c = obj;
88
t.equal(inspect(obj), '{ a: 1, b: [ 3, 4 ], c: [Circular] }');
9+
10+
var double = {};
11+
double.a = [double];
12+
double.b = {};
13+
double.b.inner = double.b;
14+
double.b.obj = double;
15+
t.equal(inspect(double), '{ a: [ [Circular] ], b: { inner: [Circular], obj: [Circular] } }');
916
});

test/deep.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ var inspect = require('../');
22
var test = require('tape');
33

44
test('deep', function (t) {
5-
t.plan(2);
5+
t.plan(3);
66
var obj = [[[[[[500]]]]]];
77
t.equal(inspect(obj), '[ [ [ [ [ [Array] ] ] ] ] ]');
8+
t.equal(inspect(obj, { depth: 4 }), '[ [ [ [ [Array] ] ] ] ]');
89
t.equal(inspect(obj, { depth: 2 }), '[ [ [Array] ] ]');
910
});

test/values.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,8 @@ test('RegExps', function (t) {
167167
t.equal(inspect(/a/g), '/a/g', 'regex shows properly');
168168
t.equal(inspect(new RegExp('abc', 'i')), '/abc/i', 'new RegExp shows properly');
169169

170+
var match = 'abc abc'.match(/[ab]+/);
171+
t.equal(inspect(match), '[ \'ab\', index: 0, input: \'abc abc\', groups: undefined ]', 'RegExp match object shows properly');
172+
170173
t.end();
171174
});

0 commit comments

Comments
 (0)