-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathtest_new.js
35 lines (30 loc) · 894 Bytes
/
test_new.js
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
// test_new.js
// -----------
// Adapted from v8/test/mjsunit/new.js
var assert = console.assert;
function Construct(x) { return x; }
assert(null != new Construct(null));
assert(void 0 != new Construct(void 0));
assert(0 != new Construct(0));
assert(1 != new Construct(1));
assert(4.2 != new Construct(4.2));
assert('foo' != new Construct('foo'));
assert(true != new Construct(true));
x = {};
assert(x === new Construct(x));
assert(x !== new Construct(null));
assert(x !== new Construct(void 0));
assert(x !== new Construct(1));
assert(x !== new Construct(3.2));
assert(x !== new Construct(false));
assert(x !== new Construct('bar'));
x = [];
assert(x === new Construct(x));
x = new Boolean(true);
assert(x === new Construct(x));
x = new Number(42);
assert(x === new Construct(x));
x = new String('foo');
assert(x === new Construct(x));
x = function() { };
assert(x === new Construct(x));