eyes-test.js
1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
var util = require('util');
var eyes = require('../lib/eyes');
eyes.inspect({
number: 42,
string: "John Galt",
regexp: /[a-z]+/,
array: [99, 168, 'x', {}],
func: function () {},
bool: false,
nil: null,
undef: undefined,
object: {attr: []}
}, "native types");
eyes.inspect({
number: new(Number)(42),
string: new(String)("John Galt"),
regexp: new(RegExp)(/[a-z]+/),
array: new(Array)(99, 168, 'x', {}),
bool: new(Boolean)(false),
object: new(Object)({attr: []}),
date: new(Date)
}, "wrapped types");
var obj = {};
obj.that = { self: obj };
obj.self = obj;
eyes.inspect(obj, "circular object");
eyes.inspect({hello: 'moto'}, "small object");
eyes.inspect({hello: new(Array)(6) }, "big object");
eyes.inspect(["hello 'world'", 'hello "world"'], "quotes");
eyes.inspect({
recommendations: [{
id: 'a7a6576c2c822c8e2bd81a27e41437d8',
key: [ 'spree', 3.764316258020699 ],
value: {
_id: 'a7a6576c2c822c8e2bd81a27e41437d8',
_rev: '1-2e2d2f7fd858c4a5984bcf809d22ed98',
type: 'domain',
domain: 'spree',
weight: 3.764316258020699,
product_id: 30
}
}]
}, 'complex');
eyes.inspect([null], "null in array");
var inspect = eyes.inspector({ stream: null });
util.puts(inspect('something', "something"));
util.puts(inspect("something else"));
util.puts(inspect(["no color"], null, { styles: false }));