Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50655 views
1
'use strict';
2
3
var ES = require('../').ES7;
4
var test = require('tape');
5
6
var forEach = require('foreach');
7
var is = require('object-is');
8
9
var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol';
10
11
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1;
12
13
var coercibleObject = { valueOf: function () { return 3; }, toString: function () { return 42; } };
14
var valueOfOnlyObject = { valueOf: function () { return 4; }, toString: function () { return {}; } };
15
var toStringOnlyObject = { valueOf: function () { return {}; }, toString: function () { return 7; } };
16
var uncoercibleObject = { valueOf: function () { return {}; }, toString: function () { return {}; } };
17
var objects = [{}, coercibleObject, toStringOnlyObject, valueOfOnlyObject];
18
var numbers = [0, -0, Infinity, -Infinity, 42];
19
var nullPrimitives = [undefined, null];
20
var nonNullNonNumberPrimitives = [true, false, 'foo', ''];
21
var nonNullPrimitives = nonNullNonNumberPrimitives.concat(numbers);
22
var nonNumberPrimitives = nullPrimitives.concat(nonNullNonNumberPrimitives);
23
var primitives = nullPrimitives.concat(nonNullPrimitives);
24
25
test('ToPrimitive', function (t) {
26
t.test('primitives', function (st) {
27
var testPrimitive = function (primitive) {
28
st.ok(is(ES.ToPrimitive(primitive), primitive), primitive + ' is returned correctly');
29
};
30
forEach(primitives, testPrimitive);
31
st.end();
32
});
33
34
t.test('objects', function (st) {
35
st.equal(ES.ToPrimitive(coercibleObject), 3, 'coercibleObject with no hint coerces to valueOf');
36
st.ok(is(ES.ToPrimitive({}), '[object Object]'), '{} with no hint coerces to Object#toString');
37
st.equal(ES.ToPrimitive(coercibleObject, Number), 3, 'coercibleObject with hint Number coerces to valueOf');
38
st.ok(is(ES.ToPrimitive({}, Number), '[object Object]'), '{} with hint Number coerces to NaN');
39
st.equal(ES.ToPrimitive(coercibleObject, String), 42, 'coercibleObject with hint String coerces to nonstringified toString');
40
st.equal(ES.ToPrimitive({}, String), '[object Object]', '{} with hint String coerces to Object#toString');
41
st.equal(ES.ToPrimitive(toStringOnlyObject), 7, 'toStringOnlyObject returns non-stringified toString');
42
st.equal(ES.ToPrimitive(valueOfOnlyObject), 4, 'valueOfOnlyObject returns valueOf');
43
st.throws(function () { return ES.ToPrimitive(uncoercibleObject); }, TypeError, 'uncoercibleObject throws a TypeError');
44
st.end();
45
});
46
47
t.end();
48
});
49
50
test('ToBoolean', function (t) {
51
t.equal(false, ES.ToBoolean(undefined), 'undefined coerces to false');
52
t.equal(false, ES.ToBoolean(null), 'null coerces to false');
53
t.equal(false, ES.ToBoolean(false), 'false returns false');
54
t.equal(true, ES.ToBoolean(true), 'true returns true');
55
forEach([0, -0, NaN], function (falsyNumber) {
56
t.equal(false, ES.ToBoolean(falsyNumber), 'falsy number ' + falsyNumber + ' coerces to false');
57
});
58
forEach([Infinity, 42, 1, -Infinity], function (truthyNumber) {
59
t.equal(true, ES.ToBoolean(truthyNumber), 'truthy number ' + truthyNumber + ' coerces to true');
60
});
61
t.equal(false, ES.ToBoolean(''), 'empty string coerces to false');
62
t.equal(true, ES.ToBoolean('foo'), 'nonempty string coerces to true');
63
forEach(objects, function (obj) {
64
t.equal(true, ES.ToBoolean(obj), 'object coerces to true');
65
});
66
t.equal(true, ES.ToBoolean(uncoercibleObject), 'uncoercibleObject coerces to true');
67
t.end();
68
});
69
70
test('ToNumber', function (t) {
71
t.ok(is(NaN, ES.ToNumber(undefined)), 'undefined coerces to NaN');
72
t.ok(is(ES.ToNumber(null), 0), 'null coerces to +0');
73
t.ok(is(ES.ToNumber(false), 0), 'false coerces to +0');
74
t.equal(1, ES.ToNumber(true), 'true coerces to 1');
75
t.ok(is(NaN, ES.ToNumber(NaN)), 'NaN returns itself');
76
forEach([0, -0, 42, Infinity, -Infinity], function (num) {
77
t.equal(num, ES.ToNumber(num), num + ' returns itself');
78
});
79
forEach(['foo', '0', '4a', '2.0', 'Infinity', '-Infinity'], function (numString) {
80
t.ok(is(+numString, ES.ToNumber(numString)), '"' + numString + '" coerces to ' + Number(numString));
81
});
82
forEach(objects, function (object) {
83
t.ok(is(ES.ToNumber(object), ES.ToNumber(ES.ToPrimitive(object))), 'object ' + object + ' coerces to same as ToPrimitive of object does');
84
});
85
t.throws(function () { return ES.ToNumber(uncoercibleObject); }, TypeError, 'uncoercibleObject throws');
86
t.end();
87
});
88
89
test('ToInteger', function (t) {
90
t.ok(is(0, ES.ToInteger(NaN)), 'NaN coerces to +0');
91
forEach([0, Infinity, 42], function (num) {
92
t.ok(is(num, ES.ToInteger(num)), num + ' returns itself');
93
t.ok(is(-num, ES.ToInteger(-num)), '-' + num + ' returns itself');
94
});
95
t.equal(3, ES.ToInteger(Math.PI), 'pi returns 3');
96
t.throws(function () { return ES.ToInteger(uncoercibleObject); }, TypeError, 'uncoercibleObject throws');
97
t.end();
98
});
99
100
test('ToInt32', function (t) {
101
t.ok(is(0, ES.ToInt32(NaN)), 'NaN coerces to +0');
102
forEach([0, Infinity], function (num) {
103
t.ok(is(0, ES.ToInt32(num)), num + ' returns +0');
104
t.ok(is(0, ES.ToInt32(-num)), '-' + num + ' returns +0');
105
});
106
t.throws(function () { return ES.ToInt32(uncoercibleObject); }, TypeError, 'uncoercibleObject throws');
107
t.ok(is(ES.ToInt32(0x100000000), 0), '2^32 returns +0');
108
t.ok(is(ES.ToInt32(0x100000000 - 1), -1), '2^32 - 1 returns -1');
109
t.ok(is(ES.ToInt32(0x80000000), -0x80000000), '2^31 returns -2^31');
110
t.ok(is(ES.ToInt32(0x80000000 - 1), 0x80000000 - 1), '2^31 - 1 returns 2^31 - 1');
111
forEach([0, Infinity, NaN, 0x100000000, 0x80000000, 0x10000, 0x42], function (num) {
112
t.ok(is(ES.ToInt32(num), ES.ToInt32(ES.ToUint32(num))), 'ToInt32(x) === ToInt32(ToUint32(x)) for 0x' + num.toString(16));
113
t.ok(is(ES.ToInt32(-num), ES.ToInt32(ES.ToUint32(-num))), 'ToInt32(x) === ToInt32(ToUint32(x)) for -0x' + num.toString(16));
114
});
115
t.end();
116
});
117
118
test('ToUint32', function (t) {
119
t.ok(is(0, ES.ToUint32(NaN)), 'NaN coerces to +0');
120
forEach([0, Infinity], function (num) {
121
t.ok(is(0, ES.ToUint32(num)), num + ' returns +0');
122
t.ok(is(0, ES.ToUint32(-num)), '-' + num + ' returns +0');
123
});
124
t.throws(function () { return ES.ToUint32(uncoercibleObject); }, TypeError, 'uncoercibleObject throws');
125
t.ok(is(ES.ToUint32(0x100000000), 0), '2^32 returns +0');
126
t.ok(is(ES.ToUint32(0x100000000 - 1), 0x100000000 - 1), '2^32 - 1 returns 2^32 - 1');
127
t.ok(is(ES.ToUint32(0x80000000), 0x80000000), '2^31 returns 2^31');
128
t.ok(is(ES.ToUint32(0x80000000 - 1), 0x80000000 - 1), '2^31 - 1 returns 2^31 - 1');
129
forEach([0, Infinity, NaN, 0x100000000, 0x80000000, 0x10000, 0x42], function (num) {
130
t.ok(is(ES.ToUint32(num), ES.ToUint32(ES.ToInt32(num))), 'ToUint32(x) === ToUint32(ToInt32(x)) for 0x' + num.toString(16));
131
t.ok(is(ES.ToUint32(-num), ES.ToUint32(ES.ToInt32(-num))), 'ToUint32(x) === ToUint32(ToInt32(x)) for -0x' + num.toString(16));
132
});
133
t.end();
134
});
135
136
test('ToInt16', function (t) {
137
t.ok(is(0, ES.ToInt16(NaN)), 'NaN coerces to +0');
138
forEach([0, Infinity], function (num) {
139
t.ok(is(0, ES.ToInt16(num)), num + ' returns +0');
140
t.ok(is(0, ES.ToInt16(-num)), '-' + num + ' returns +0');
141
});
142
t.throws(function () { return ES.ToInt16(uncoercibleObject); }, TypeError, 'uncoercibleObject throws');
143
t.ok(is(ES.ToInt16(0x100000000), 0), '2^32 returns +0');
144
t.ok(is(ES.ToInt16(0x100000000 - 1), -1), '2^32 - 1 returns -1');
145
t.ok(is(ES.ToInt16(0x80000000), 0), '2^31 returns +0');
146
t.ok(is(ES.ToInt16(0x80000000 - 1), -1), '2^31 - 1 returns -1');
147
t.ok(is(ES.ToInt16(0x10000), 0), '2^16 returns +0');
148
t.ok(is(ES.ToInt16(0x10000 - 1), -1), '2^16 - 1 returns -1');
149
t.end();
150
});
151
152
test('ToUint16', function (t) {
153
t.ok(is(0, ES.ToUint16(NaN)), 'NaN coerces to +0');
154
forEach([0, Infinity], function (num) {
155
t.ok(is(0, ES.ToUint16(num)), num + ' returns +0');
156
t.ok(is(0, ES.ToUint16(-num)), '-' + num + ' returns +0');
157
});
158
t.throws(function () { return ES.ToUint16(uncoercibleObject); }, TypeError, 'uncoercibleObject throws');
159
t.ok(is(ES.ToUint16(0x100000000), 0), '2^32 returns +0');
160
t.ok(is(ES.ToUint16(0x100000000 - 1), 0x10000 - 1), '2^32 - 1 returns 2^16 - 1');
161
t.ok(is(ES.ToUint16(0x80000000), 0), '2^31 returns +0');
162
t.ok(is(ES.ToUint16(0x80000000 - 1), 0x10000 - 1), '2^31 - 1 returns 2^16 - 1');
163
t.ok(is(ES.ToUint16(0x10000), 0), '2^16 returns +0');
164
t.ok(is(ES.ToUint16(0x10000 - 1), 0x10000 - 1), '2^16 - 1 returns 2^16 - 1');
165
t.end();
166
});
167
168
test('ToInt8', function (t) {
169
t.ok(is(0, ES.ToInt8(NaN)), 'NaN coerces to +0');
170
forEach([0, Infinity], function (num) {
171
t.ok(is(0, ES.ToInt8(num)), num + ' returns +0');
172
t.ok(is(0, ES.ToInt8(-num)), '-' + num + ' returns +0');
173
});
174
t.throws(function () { return ES.ToInt8(uncoercibleObject); }, TypeError, 'uncoercibleObject throws');
175
t.ok(is(ES.ToInt8(0x100000000), 0), '2^32 returns +0');
176
t.ok(is(ES.ToInt8(0x100000000 - 1), -1), '2^32 - 1 returns -1');
177
t.ok(is(ES.ToInt8(0x80000000), 0), '2^31 returns +0');
178
t.ok(is(ES.ToInt8(0x80000000 - 1), -1), '2^31 - 1 returns -1');
179
t.ok(is(ES.ToInt8(0x10000), 0), '2^16 returns +0');
180
t.ok(is(ES.ToInt8(0x10000 - 1), -1), '2^16 - 1 returns -1');
181
t.ok(is(ES.ToInt8(0x100), 0), '2^8 returns +0');
182
t.ok(is(ES.ToInt8(0x100 - 1), -1), '2^8 - 1 returns -1');
183
t.ok(is(ES.ToInt8(0x10), 0x10), '2^4 returns 2^4');
184
t.end();
185
});
186
187
test('ToUint8', function (t) {
188
t.ok(is(0, ES.ToUint8(NaN)), 'NaN coerces to +0');
189
forEach([0, Infinity], function (num) {
190
t.ok(is(0, ES.ToUint8(num)), num + ' returns +0');
191
t.ok(is(0, ES.ToUint8(-num)), '-' + num + ' returns +0');
192
});
193
t.throws(function () { return ES.ToUint8(uncoercibleObject); }, TypeError, 'uncoercibleObject throws');
194
t.ok(is(ES.ToUint8(0x100000000), 0), '2^32 returns +0');
195
t.ok(is(ES.ToUint8(0x100000000 - 1), 0x100 - 1), '2^32 - 1 returns 2^8 - 1');
196
t.ok(is(ES.ToUint8(0x80000000), 0), '2^31 returns +0');
197
t.ok(is(ES.ToUint8(0x80000000 - 1), 0x100 - 1), '2^31 - 1 returns 2^8 - 1');
198
t.ok(is(ES.ToUint8(0x10000), 0), '2^16 returns +0');
199
t.ok(is(ES.ToUint8(0x10000 - 1), 0x100 - 1), '2^16 - 1 returns 2^8 - 1');
200
t.ok(is(ES.ToUint8(0x100), 0), '2^8 returns +0');
201
t.ok(is(ES.ToUint8(0x100 - 1), 0x100 - 1), '2^8 - 1 returns 2^16 - 1');
202
t.ok(is(ES.ToUint8(0x10), 0x10), '2^4 returns 2^4');
203
t.ok(is(ES.ToUint8(0x10 - 1), 0x10 - 1), '2^4 - 1 returns 2^4 - 1');
204
t.end();
205
});
206
207
test('ToUint8Clamp', function (t) {
208
t.ok(is(0, ES.ToUint8Clamp(NaN)), 'NaN coerces to +0');
209
t.ok(is(0, ES.ToUint8Clamp(0)), '+0 returns +0');
210
t.ok(is(0, ES.ToUint8Clamp(-0)), '-0 returns +0');
211
t.ok(is(0, ES.ToUint8Clamp(-Infinity)), '-Infinity returns +0');
212
t.throws(function () { return ES.ToUint8Clamp(uncoercibleObject); }, TypeError, 'uncoercibleObject throws');
213
forEach([255, 256, 0x100000, Infinity], function (number) {
214
t.ok(is(255, ES.ToUint8Clamp(number)), number + ' coerces to 255');
215
});
216
t.equal(1, ES.ToUint8Clamp(1.49), '1.49 coerces to 1');
217
t.equal(2, ES.ToUint8Clamp(1.5), '1.5 coerces to 2, because 2 is even');
218
t.equal(2, ES.ToUint8Clamp(1.51), '1.51 coerces to 2');
219
220
t.equal(2, ES.ToUint8Clamp(2.49), '2.49 coerces to 2');
221
t.equal(2, ES.ToUint8Clamp(2.5), '2.5 coerces to 2, because 2 is even');
222
t.equal(3, ES.ToUint8Clamp(2.51), '2.51 coerces to 3');
223
t.end();
224
});
225
226
test('ToString', function (t) {
227
t.throws(function () { return ES.ToString(uncoercibleObject); }, TypeError, 'uncoercibleObject throws');
228
t.end();
229
});
230
231
test('ToObject', function (t) {
232
t.throws(function () { return ES.ToObject(undefined); }, TypeError, 'undefined throws');
233
t.throws(function () { return ES.ToObject(null); }, TypeError, 'null throws');
234
forEach(numbers, function (number) {
235
var obj = ES.ToObject(number);
236
t.equal(typeof obj, 'object', 'number ' + number + ' coerces to object');
237
t.equal(true, obj instanceof Number, 'object of ' + number + ' is Number object');
238
t.ok(is(obj.valueOf(), number), 'object of ' + number + ' coerces to ' + number);
239
});
240
t.end();
241
});
242
243
test('RequireObjectCoercible', function (t) {
244
t.equal(false, 'CheckObjectCoercible' in ES, 'CheckObjectCoercible -> RequireObjectCoercible in ES6');
245
t.throws(function () { return ES.RequireObjectCoercible(undefined); }, TypeError, 'undefined throws');
246
t.throws(function () { return ES.RequireObjectCoercible(null); }, TypeError, 'null throws');
247
var isCoercible = function (value) {
248
t.doesNotThrow(function () { return ES.RequireObjectCoercible(value); }, '"' + value + '" does not throw');
249
};
250
forEach(objects.concat(nonNullPrimitives), isCoercible);
251
t.end();
252
});
253
254
test('IsCallable', function (t) {
255
t.equal(true, ES.IsCallable(function () {}), 'function is callable');
256
var nonCallables = [/a/g, {}, Object.prototype, NaN].concat(primitives);
257
forEach(nonCallables, function (nonCallable) {
258
t.equal(false, ES.IsCallable(nonCallable), nonCallable + ' is not callable');
259
});
260
t.end();
261
});
262
263
test('SameValue', function (t) {
264
t.equal(true, ES.SameValue(NaN, NaN), 'NaN is SameValue as NaN');
265
t.equal(false, ES.SameValue(0, -0), '+0 is not SameValue as -0');
266
forEach(objects.concat(primitives), function (val) {
267
t.equal(val === val, ES.SameValue(val, val), '"' + val + '" is SameValue to itself');
268
});
269
t.end();
270
});
271
272
test('SameValueZero', function (t) {
273
t.equal(true, ES.SameValueZero(NaN, NaN), 'NaN is SameValueZero as NaN');
274
t.equal(true, ES.SameValueZero(0, -0), '+0 is SameValueZero as -0');
275
forEach(objects.concat(primitives), function (val) {
276
t.equal(val === val, ES.SameValueZero(val, val), '"' + val + '" is SameValueZero to itself');
277
});
278
t.end();
279
});
280
281
test('ToPropertyKey', function (t) {
282
forEach(objects.concat(primitives), function (value) {
283
t.equal(ES.ToPropertyKey(value), String(value), 'ToPropertyKey(value) === String(value) for non-Symbols');
284
});
285
if (hasSymbols) {
286
t.equal(ES.ToPropertyKey(Symbol.iterator), 'Symbol(Symbol.iterator)', 'ToPropertyKey(Symbol.iterator) === "Symbol(Symbol.iterator)"');
287
}
288
t.end();
289
});
290
291
test('ToLength', function (t) {
292
t.throws(function () { return ES.ToLength(uncoercibleObject); }, TypeError, 'uncoercibleObject throws a TypeError');
293
t.equal(3, ES.ToLength(coercibleObject), 'coercibleObject coerces to 3');
294
t.equal(42, ES.ToLength('42.5'), '"42.5" coerces to 42');
295
t.equal(7, ES.ToLength(7.3), '7.3 coerces to 7');
296
forEach([-0, -1, -42, -Infinity], function (negative) {
297
t.ok(is(0, ES.ToLength(negative)), negative + ' coerces to +0');
298
});
299
t.equal(MAX_SAFE_INTEGER, ES.ToLength(MAX_SAFE_INTEGER + 1), '2^53 coerces to 2^53 - 1');
300
t.equal(MAX_SAFE_INTEGER, ES.ToLength(MAX_SAFE_INTEGER + 3), '2^53 + 2 coerces to 2^53 - 1');
301
t.end();
302
});
303
304
test('IsArray', function (t) {
305
t.equal(true, ES.IsArray([]), '[] is array');
306
t.equal(false, ES.IsArray({}), '{} is not array');
307
t.equal(false, ES.IsArray({ length: 1, 0: true }), 'arraylike object is not array');
308
forEach(objects.concat(primitives), function (value) {
309
t.equal(false, ES.IsArray(value), value + ' is not array');
310
});
311
t.end();
312
});
313
314
test('IsRegExp', function (t) {
315
forEach([/a/g, new RegExp('a', 'g')], function (regex) {
316
t.equal(true, ES.IsRegExp(regex), regex + ' is regex');
317
});
318
forEach(objects.concat(primitives), function (nonRegex) {
319
t.equal(false, ES.IsRegExp(nonRegex), nonRegex + ' is not regex');
320
});
321
t.end();
322
});
323
324
test('IsPropertyKey', function (t) {
325
forEach(numbers.concat(objects), function (notKey) {
326
t.equal(false, ES.IsPropertyKey(notKey), notKey + ' is not property key');
327
});
328
t.equal(true, ES.IsPropertyKey('foo'), 'string is property key');
329
if (hasSymbols) {
330
t.equal(true, ES.IsPropertyKey(Symbol.iterator), 'Symbol.iterator is property key');
331
}
332
t.end();
333
});
334
335
test('IsInteger', function (t) {
336
for (var i = -100; i < 100; i += 10) {
337
t.equal(true, ES.IsInteger(i), i + ' is integer');
338
t.equal(false, ES.IsInteger(i + 0.2), (i + 0.2) + ' is not integer');
339
}
340
t.equal(true, ES.IsInteger(-0), '-0 is integer');
341
var notInts = objects.concat([Infinity, -Infinity, NaN, true, false, null, undefined, [], new Date()]);
342
if (hasSymbols) { notInts.push(Symbol.iterator); }
343
forEach(notInts, function (notInt) {
344
t.equal(false, ES.IsInteger(notInt), ES.ToPropertyKey(notInt) + ' is not integer');
345
});
346
t.equal(false, ES.IsInteger(uncoercibleObject), 'uncoercibleObject is not integer');
347
t.end();
348
});
349
350
test('IsExtensible', function (t) {
351
forEach(objects, function (object) {
352
t.equal(true, ES.IsExtensible(object), object + ' object is extensible');
353
});
354
forEach(primitives, function (primitive) {
355
t.equal(false, ES.IsExtensible(primitive), primitive + ' is not extensible');
356
});
357
if (Object.preventExtensions) {
358
t.equal(false, ES.IsExtensible(Object.preventExtensions({})), 'object with extensions prevented is not extensible');
359
}
360
t.end();
361
});
362
363
test('CanonicalNumericIndexString', function (t) {
364
var throwsOnNonString = function (notString) {
365
t.throws(function () { return ES.CanonicalNumericIndexString(notString); }, TypeError, notString + ' is not a string');
366
};
367
forEach(objects.concat(numbers), throwsOnNonString);
368
t.ok(is(-0, ES.CanonicalNumericIndexString('-0')), '"-0" returns -0');
369
for (var i = -50; i < 50; i += 10) {
370
t.equal(i, ES.CanonicalNumericIndexString(String(i)), '"' + i + '" returns ' + i);
371
t.equal(undefined, ES.CanonicalNumericIndexString(String(i) + 'a'), '"' + i + 'a" returns undefined');
372
}
373
t.end();
374
});
375
376
test('IsConstructor', function (t) {
377
t.equal(true, ES.IsConstructor(function () {}), 'function is constructor');
378
t.equal(false, ES.IsConstructor(/a/g), 'regex is not constructor');
379
forEach(objects, function (object) {
380
t.equal(false, ES.IsConstructor(object), object + ' object is not constructor');
381
});
382
t.end();
383
});
384
385
test('Call', function (t) {
386
var receiver = {};
387
var notFuncs = objects.concat(primitives).concat([/a/g, new RegExp('a', 'g')]);
388
t.plan(notFuncs.length + 4);
389
var throwsIfNotCallable = function (notFunc) {
390
t.throws(function () { return ES.Call(notFunc, receiver); }, TypeError, notFunc + ' (' + typeof notFunc + ') is not callable');
391
};
392
forEach(notFuncs, throwsIfNotCallable);
393
ES.Call(function (a, b) {
394
t.equal(this, receiver, 'context matches expected');
395
t.deepEqual([a, b], [1, 2], 'named args are correct');
396
t.equal(arguments.length, 3, 'extra argument was passed');
397
t.equal(arguments[2], 3, 'extra argument was correct');
398
}, receiver, [1, 2, 3]);
399
t.end();
400
});
401
402
test('SameValueNonNumber', function (t) {
403
var willThrow = [
404
[3, 4],
405
[NaN, 4],
406
[4, ''],
407
['abc', true],
408
[{}, false]
409
];
410
forEach(willThrow, function (nums) {
411
t.throws(function () { return ES.SameValueNonNumber.apply(ES, nums); }, TypeError, 'value must be same type and non-number');
412
});
413
414
forEach(objects.concat(nonNumberPrimitives), function (val) {
415
t.equal(val === val, ES.SameValueNonNumber(val, val), '"' + val + '" is SameValueNonNumber to itself');
416
});
417
418
t.end();
419
});
420
421