project files added
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"globals": {
|
||||
"Symbol": true
|
||||
},
|
||||
"rules": {
|
||||
"consistent-this": "off",
|
||||
"id-length": "off",
|
||||
"no-empty-function": "off",
|
||||
"no-eval": "off",
|
||||
"no-new-wrappers": "off",
|
||||
"no-prototype-builtins": "off",
|
||||
"no-shadow": "off"
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
exports.context = null;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../../array/#/@@iterator/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
exports.__generic = function (t, a) {
|
||||
var iterator = t.call(this);
|
||||
a.deep(iterator.next(), { value: "1", done: false });
|
||||
a.deep(iterator.next(), { value: "2", done: false });
|
||||
a.deep(iterator.next(), { value: "3", done: false });
|
||||
a.deep(iterator.next(), { value: undefined, done: true });
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var arr = [4, 5, 6], obj1 = { length: 8 }, obj2 = {}, obj3 = { length: 1 };
|
||||
|
||||
a.deep([arr, obj1, obj2, obj3].sort(t), [obj2, obj3, arr, obj1]);
|
||||
};
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
var compare = function (value) {
|
||||
return this - value;
|
||||
};
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var arr;
|
||||
arr = [2, 5, 5, 8, 34, 67, 98, 345, 678];
|
||||
|
||||
// Highest, equal match
|
||||
a(t.call(arr, compare.bind(1)), 0, "All higher");
|
||||
a(t.call(arr, compare.bind(679)), arr.length - 1, "All lower");
|
||||
a(t.call(arr, compare.bind(4)), 0, "Mid");
|
||||
a(t.call(arr, compare.bind(5)), 2, "Match");
|
||||
a(t.call(arr, compare.bind(6)), 2, "Above");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var arr = [1, 2, {}, 4];
|
||||
a(t.call(arr), arr, "Returns same array");
|
||||
a.deep(arr, [], "Empties array");
|
||||
};
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"__generic": function (t, a) {
|
||||
a(t.call(this).length, 3);
|
||||
},
|
||||
"": function (t, a) {
|
||||
var o, x, y, z;
|
||||
o = {};
|
||||
x = [0, 1, "", null, o, false, undefined, true];
|
||||
y = x.slice(0);
|
||||
|
||||
a.not(z = t.call(x), x, "Returns different object");
|
||||
a.deep(x, y, "Origin not changed");
|
||||
a.deep(z, [0, 1, "", o, false, true], "Result");
|
||||
}
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../../array/#/concat/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
|
||||
var isConcatSpreadable = require("es6-symbol").isConcatSpreadable
|
||||
, SubArray = require("../../../../array/_sub-array-dummy-safe");
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var arr = [1, 3, 45], x = {}, subArr, subArr2, result;
|
||||
|
||||
a.deep(t.call(arr, "2d", x, ["ere", "fe", x], false, null),
|
||||
[1, 3, 45, "2d", x, "ere", "fe", x, false, null], "Plain array");
|
||||
|
||||
subArr = new SubArray("lol", "miszko");
|
||||
subArr2 = new SubArray("elo", "fol");
|
||||
|
||||
result = t.call(subArr, "df", arr, "fef", subArr2, null);
|
||||
a(result instanceof SubArray, true, "Instance of subclass");
|
||||
a.deep(result, ["lol", "miszko", "df", 1, 3, 45, "fef", "elo", "fol", null],
|
||||
"Spreable by default");
|
||||
|
||||
SubArray.prototype[isConcatSpreadable] = false;
|
||||
|
||||
result = t.call(subArr, "df", arr, "fef", subArr2, null);
|
||||
a.deep(result, [subArr, "df", 1, 3, 45, "fef", subArr2, null], "Non spreadable");
|
||||
|
||||
delete SubArray.prototype[isConcatSpreadable];
|
||||
};
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"__generic": function (t, a) {
|
||||
a(t.call(this, this[1]), true, "Contains");
|
||||
a(t.call(this, {}), false, "Does Not contain");
|
||||
},
|
||||
"": function (t, a) {
|
||||
var o, x = {}, y = {};
|
||||
|
||||
o = [1, "raz", x];
|
||||
|
||||
a(t.call(o, 1), true, "First");
|
||||
a(t.call(o, "1"), false, "Type coercion");
|
||||
a(t.call(o, "raz"), true, "Primitive");
|
||||
a(t.call(o, "foo"), false, "Primitive not found");
|
||||
a(t.call(o, x), true, "Object found");
|
||||
a(t.call(o, y), false, "Object not found");
|
||||
a(t.call(o, 1, 1), false, "Position");
|
||||
}
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../../array/#/copy-within/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var args, x;
|
||||
|
||||
a.h1("2 args");
|
||||
x = [1, 2, 3, 4, 5];
|
||||
t.call(x, 0, 3);
|
||||
a.deep(x, [4, 5, 3, 4, 5]);
|
||||
a.deep(t.call([1, 2, 3, 4, 5], 1, 3), [1, 4, 5, 4, 5]);
|
||||
a.deep(t.call([1, 2, 3, 4, 5], 1, 2), [1, 3, 4, 5, 5]);
|
||||
a.deep(t.call([1, 2, 3, 4, 5], 2, 2), [1, 2, 3, 4, 5]);
|
||||
|
||||
a.h1("3 args");
|
||||
a.deep(t.call([1, 2, 3, 4, 5], 0, 3, 4), [4, 2, 3, 4, 5]);
|
||||
a.deep(t.call([1, 2, 3, 4, 5], 1, 3, 4), [1, 4, 3, 4, 5]);
|
||||
a.deep(t.call([1, 2, 3, 4, 5], 1, 2, 4), [1, 3, 4, 4, 5]);
|
||||
|
||||
a.h1("Negative args");
|
||||
a.deep(t.call([1, 2, 3, 4, 5], 0, -2), [4, 5, 3, 4, 5]);
|
||||
a.deep(t.call([1, 2, 3, 4, 5], 0, -2, -1), [4, 2, 3, 4, 5]);
|
||||
a.deep(t.call([1, 2, 3, 4, 5], -4, -3, -2), [1, 3, 3, 4, 5]);
|
||||
a.deep(t.call([1, 2, 3, 4, 5], -4, -3, -1), [1, 3, 4, 4, 5]);
|
||||
a.deep(t.call([1, 2, 3, 4, 5], -4, -3), [1, 3, 4, 5, 5]);
|
||||
|
||||
a.h1("Array-likes");
|
||||
args = { 0: 1, 1: 2, 2: 3, length: 3 };
|
||||
a.deep(t.call(args, -2, 0), { 0: 1, 1: 1, 2: 2, length: 3 });
|
||||
};
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"__generic": function (t, a) {
|
||||
a.deep(t.call(this, this), []);
|
||||
},
|
||||
"": function (t, a) {
|
||||
var x = {}, y = {};
|
||||
|
||||
a.deep(t.call([1, "raz", x, 2, "trzy", y], [x, 2, "trzy"]), [1, "raz", y],
|
||||
"Scope longer");
|
||||
a.deep(t.call([1, "raz", x], [x, 2, "trzy", 1, y]), ["raz"],
|
||||
"Arg longer");
|
||||
a.deep(t.call([1, "raz", x], []), [1, "raz", x], "Empty arg");
|
||||
a.deep(t.call([], [1, y, "sdfs"]), [], "Empty scope");
|
||||
}
|
||||
};
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x = {};
|
||||
a(t.call([3, "raz", {}, x, {}], x), 3, "Regular");
|
||||
a(t.call([3, "raz", NaN, {}, NaN], NaN), 2, "NaN");
|
||||
a(t.call([3, "raz", 0, {}, -0], -0), 2, "-0");
|
||||
a(t.call([3, "raz", -0, {}, 0], +0), 2, "+0");
|
||||
a(t.call([3, "raz", NaN, {}, NaN], NaN, 3), 4, "fromIndex");
|
||||
a(t.call([3, "raz", NaN, {}, NaN], NaN, -1), 4, "fromIndex negative #1");
|
||||
a(t.call([3, "raz", NaN, {}, NaN], NaN, -2), 4, "fromIndex negative #2");
|
||||
a(t.call([3, "raz", NaN, {}, NaN], NaN, -3), 2, "fromIndex negative #3");
|
||||
};
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x = {};
|
||||
a(t.call([3, "raz", {}, x, {}, x], x), 5, "Regular");
|
||||
a(t.call([3, "raz", NaN, {}, x], NaN), 2, "NaN");
|
||||
a(t.call([3, "raz", 0, {}, -0], -0), 4, "-0");
|
||||
a(t.call([3, "raz", -0, {}, 0], +0), 4, "+0");
|
||||
a(t.call([3, "raz", NaN, {}, NaN], NaN, 3), 2, "fromIndex");
|
||||
a(t.call([3, "raz", NaN, 2, NaN], NaN, -1), 4, "Negative fromIndex #1");
|
||||
a(t.call([3, "raz", NaN, 2, NaN], NaN, -2), 2, "Negative fromIndex #2");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../../array/#/entries/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
exports.__generic = function (t, a) {
|
||||
var iterator = t.call(this);
|
||||
a.deep(iterator.next(), { value: [0, "1"], done: false });
|
||||
a.deep(iterator.next(), { value: [1, "2"], done: false });
|
||||
a.deep(iterator.next(), { value: [2, "3"], done: false });
|
||||
a.deep(iterator.next(), { value: undefined, done: true });
|
||||
};
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"__generic": function (t, a) {
|
||||
var x = {};
|
||||
a.deep(t.call(this, this, [this[0], this[2], x]), [x]);
|
||||
},
|
||||
"": function (t, a) {
|
||||
var x = {}, y = {};
|
||||
|
||||
a.deep(t.call([x, y]), [x, y], "No arguments");
|
||||
a.deep(t.call([x, 1], [], []), [x, 1], "Empty arguments");
|
||||
a.deep(t.call([1, "raz", x], [2, "raz", y], [2, "raz", x]), [1, y]);
|
||||
}
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../../array/#/fill/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// Taken from https://github.com/paulmillr/es6-shim/blob/master/test/array.js
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x;
|
||||
|
||||
x = [1, 2, 3, 4, 5, 6];
|
||||
a(t.call(x, -1), x, "Returns self object");
|
||||
a.deep(x, [-1, -1, -1, -1, -1, -1], "Value");
|
||||
|
||||
a.deep(t.call([1, 2, 3, 4, 5, 6], -1, 3), [1, 2, 3, -1, -1, -1],
|
||||
"Positive start");
|
||||
a.deep(t.call([1, 2, 3, 4, 5, 6], -1, -3), [1, 2, 3, -1, -1, -1],
|
||||
"Negative start");
|
||||
a.deep(t.call([1, 2, 3, 4, 5, 6], -1, 9), [1, 2, 3, 4, 5, 6],
|
||||
"Large start");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../../array/#/filter/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
var SubArray = require("../../../../array/_sub-array-dummy-safe");
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var arr, x = {}, subArr, result;
|
||||
|
||||
arr = ["foo", undefined, 0, "2d", false, x, null];
|
||||
|
||||
a.deep(t.call(arr, Boolean), ["foo", "2d", x], "Plain array");
|
||||
|
||||
subArr = new SubArray("foo", undefined, 0, "2d", false, x, null);
|
||||
|
||||
result = t.call(subArr, Boolean);
|
||||
a(result instanceof SubArray, true, "Instance of subclass");
|
||||
a.deep(result, ["foo", "2d", x], "Result of subclass");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../../array/#/find-index/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
exports.__generic = function (t, a) {
|
||||
var count = 0, o = {}, self = Object(this);
|
||||
a(t.call(self, function (value, i, scope) {
|
||||
a(value, this[i], "Value");
|
||||
a(i, count++, "Index");
|
||||
a(scope, this, "Scope");
|
||||
}, self), -1, "Falsy result");
|
||||
a(count, 3);
|
||||
|
||||
count = -1;
|
||||
a(t.call(this, function () {
|
||||
return ++count ? o : null;
|
||||
}, this), 1, "Truthy result");
|
||||
a(count, 1);
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../../array/#/find/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
exports.__generic = function (t, a) {
|
||||
var count = 0, o = {}, self = Object(this);
|
||||
a(t.call(self, function (value, i, scope) {
|
||||
a(value, this[i], "Value");
|
||||
a(i, count++, "Index");
|
||||
a(scope, this, "Scope");
|
||||
}, self), undefined, "Falsy result");
|
||||
a(count, 3);
|
||||
|
||||
count = -1;
|
||||
a(t.call(this, function () {
|
||||
return ++count ? o : null;
|
||||
}, this), this[1], "Truthy result");
|
||||
a(count, 1);
|
||||
};
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x;
|
||||
a(t.call([]), null, "Empty");
|
||||
a(t.call([null]), 0, "One value");
|
||||
a(t.call([1, 2, 3]), 0, "Many values");
|
||||
a(t.call(new Array(1000)), null, "Sparse empty");
|
||||
x = [];
|
||||
x[883] = undefined;
|
||||
x[890] = null;
|
||||
a(t.call(x), 883, "Manual sparse, distant value");
|
||||
x = new Array(1000);
|
||||
x[657] = undefined;
|
||||
x[700] = null;
|
||||
a(t.call(x), 657, "Sparse, distant value");
|
||||
};
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
exports.__generic = function (t, a) {
|
||||
a(t.call(this), this[0]);
|
||||
};
|
||||
exports[""] = function (t, a) {
|
||||
var x;
|
||||
a(t.call([]), undefined, "Empty");
|
||||
a(t.call(new Array(234), undefined, "Sparse empty"));
|
||||
x = new Array(2342);
|
||||
x[434] = {};
|
||||
a(t.call(x), x[434], "Sparse");
|
||||
};
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
var o = [1, 2, [3, 4, [5, 6], 7, 8], 9, 10, [11, 12, [13, 14]], 15];
|
||||
|
||||
module.exports = {
|
||||
"__generic": function (t, a) {
|
||||
a(t.call(this).length, 3);
|
||||
},
|
||||
"Nested Arrays": function (t, a) {
|
||||
var result = t.call(o);
|
||||
a.not(o, result);
|
||||
a.deep(result, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
|
||||
}
|
||||
};
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"__generic": function (t, a) {
|
||||
var count = 0, first, last, x, icount = this.length;
|
||||
t.call(this, function (item, index, col) {
|
||||
++count;
|
||||
if (!first) {
|
||||
first = item;
|
||||
}
|
||||
last = item;
|
||||
x = col;
|
||||
a(index, --icount, "Index");
|
||||
});
|
||||
a(count, this.length, "Iterated");
|
||||
a(first, this[this.length - 1], "First is last");
|
||||
a(last, this[0], "Last is first");
|
||||
a.deep(x, Object(this), "Collection as third argument"); // Jslint: skip
|
||||
},
|
||||
"": function (t, a) {
|
||||
var x = {}, y, count;
|
||||
t.call(
|
||||
[1],
|
||||
function () {
|
||||
y = this;
|
||||
},
|
||||
x
|
||||
);
|
||||
a(y, x, "Scope");
|
||||
y = 0;
|
||||
t.call([3, 4, 4], function (a, i) {
|
||||
y += i;
|
||||
});
|
||||
a(y, 3, "Indexes");
|
||||
|
||||
x = [1, 3];
|
||||
x[5] = "x";
|
||||
y = 0;
|
||||
count = 0;
|
||||
t.call(x, function (a, i) {
|
||||
++count;
|
||||
y += i;
|
||||
});
|
||||
a(y, 6, "Misssing Indexes");
|
||||
a(count, 3, "Misssing Indexes, count");
|
||||
}
|
||||
};
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"__generic": function (t, a) {
|
||||
var count = 0, self;
|
||||
|
||||
self = Object(this);
|
||||
a.deep(t.call(self, function (v, i, scope) {
|
||||
a(v, this[i], "Value");
|
||||
a(i, count++, "Index");
|
||||
a(scope, this, "Scope");
|
||||
return i;
|
||||
}, self), { 0: [this[0]], 1: [this[1]], 2: [this[2]] });
|
||||
},
|
||||
"": function (t, a) {
|
||||
var r;
|
||||
r = t.call([2, 3, 3, 4, 5, 6, 7, 7, 23, 45, 34, 56],
|
||||
function (v) {
|
||||
return v % 2 ? "odd" : "even";
|
||||
});
|
||||
a.deep(r.odd, [3, 3, 5, 7, 7, 23, 45]);
|
||||
a.deep(r.even, [2, 4, 6, 34, 56]);
|
||||
}
|
||||
};
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"__generic": function (t, a) {
|
||||
a.deep(t.call(this, this[1]), [1]);
|
||||
},
|
||||
"": function (t, a) {
|
||||
var x = {};
|
||||
a.deep(t.call([1, 3, 5, 3, 5], 6), [], "No result");
|
||||
a.deep(t.call([1, 3, 5, 1, 3, 5, 1], 1), [0, 3, 6], "Some results");
|
||||
a.deep(t.call([], x), [], "Empty array");
|
||||
a.deep(t.call([x, 3, {}, x, 3, 5, x], x), [0, 3, 6], "Search for object");
|
||||
}
|
||||
};
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
var toArray = require("../../../array/to-array");
|
||||
|
||||
module.exports = {
|
||||
"__generic": function (t, a) {
|
||||
a.deep(t.call(this, this, this), toArray(this));
|
||||
},
|
||||
"": function (t, a) {
|
||||
var x = {}, y = {}, p, r;
|
||||
a.deep(t.call([], [2, 3, 4]), [], "Empty #1");
|
||||
a.deep(t.call([2, 3, 4], []), [], "Empty #2");
|
||||
a.deep(t.call([2, 3, x], [y, 5, 7]), [], "Different");
|
||||
p = t.call([3, 5, "raz", {}, "dwa", x], [1, 3, "raz", "dwa", "trzy", x, {}],
|
||||
[3, "raz", x, 65]);
|
||||
r = [3, "raz", x];
|
||||
p.sort();
|
||||
r.sort();
|
||||
a.deep(p, r, "Same parts");
|
||||
a.deep(t.call(r, r), r, "Same");
|
||||
a.deep(t.call([1, 2, x, 4, 5, y, 7], [7, y, 5, 4, x, 2, 1]),
|
||||
[1, 2, x, 4, 5, y, 7], "Long reverse same");
|
||||
}
|
||||
};
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x = {};
|
||||
a(t.call([], []), true, "Empty");
|
||||
a(t.call([], {}), true, "Empty lists");
|
||||
a(t.call([1, x, "raz"], [1, x, "raz"]), true, "Same");
|
||||
a(t.call([1, x, "raz"], { 0: 1, 1: x, 2: "raz", length: 3 }), true,
|
||||
"Same lists");
|
||||
a(t.call([1, x, "raz"], [x, 1, "raz"]), false, "Diff order");
|
||||
a(t.call([1, x], [1, x, "raz"]), false, "Diff length #1");
|
||||
a(t.call([1, x, "raz"], [1, x]), false, "Diff length #2");
|
||||
};
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x = {};
|
||||
a(t.call([]), true, "Empty");
|
||||
a(t.call({ length: 0 }), true, "Empty lists");
|
||||
a(t.call([1, x, "raz"]), false, "Non empty");
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x = {};
|
||||
a(t.call([]), true, "Empty");
|
||||
a(t.call({}), true, "Empty lists");
|
||||
a(t.call([1, x, "raz"]), true, "Uniq");
|
||||
a(t.call([1, x, 1, "raz"]), false, "Not Uniq: primitive");
|
||||
a(t.call([1, x, "1", "raz"]), true, "Uniq: primitive");
|
||||
a(t.call([1, x, 1, {}, "raz"]), false, "Not Uniq: Obj");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../../array/#/keys/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
exports.__generic = function (t, a) {
|
||||
var iterator = t.call(this);
|
||||
a.deep(iterator.next(), { value: 0, done: false });
|
||||
a.deep(iterator.next(), { value: 1, done: false });
|
||||
a.deep(iterator.next(), { value: 2, done: false });
|
||||
a.deep(iterator.next(), { value: undefined, done: true });
|
||||
};
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x;
|
||||
a(t.call([]), null, "Empty");
|
||||
a(t.call([null]), 0, "One value");
|
||||
a(t.call([1, 2, 3]), 2, "Many values");
|
||||
a(t.call(new Array(1000)), null, "Sparse empty");
|
||||
x = [];
|
||||
x[883] = null;
|
||||
x[890] = undefined;
|
||||
a(t.call(x), 890, "Manual sparse, distant value");
|
||||
x = new Array(1000);
|
||||
x[657] = null;
|
||||
x[700] = undefined;
|
||||
a(t.call(x), 700, "Sparse, distant value");
|
||||
};
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
exports.__generic = function (t, a) {
|
||||
a(t.call(this), this[this.length - 1]);
|
||||
};
|
||||
|
||||
exports[""] = function (t, a) {
|
||||
var x;
|
||||
a(t.call([]), undefined, "Empty");
|
||||
a(t.call(new Array(234), undefined, "Sparse empty"));
|
||||
x = new Array(2342);
|
||||
x[434] = {};
|
||||
x[450] = {};
|
||||
a(t.call(x), x[450], "Sparse");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../../array/#/map/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
var SubArray = require("../../../../array/_sub-array-dummy-safe");
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var arr, x = {}, subArr, result;
|
||||
|
||||
arr = ["foo", undefined, 0, "2d", false, x, null];
|
||||
|
||||
a.deep(t.call(arr, Boolean), [true, false, false, true, false, true, false],
|
||||
"Plain array");
|
||||
|
||||
subArr = new SubArray("foo", undefined, 0, "2d", false, x, null);
|
||||
|
||||
result = t.call(subArr, Boolean);
|
||||
a(result instanceof SubArray, true, "Instance of subclass");
|
||||
a.deep(result, [true, false, false, true, false, true, false],
|
||||
"Result of subclass");
|
||||
};
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var y = {}, z = {}, x = [9, z, 5, y, "foo"];
|
||||
t.call(x, y);
|
||||
a.deep(x, [9, z, 5, "foo"]);
|
||||
t.call(x, {});
|
||||
a.deep(x, [9, z, 5, "foo"], "Not existing");
|
||||
t.call(x, 5);
|
||||
a.deep(x, [9, z, "foo"], "Primitive");
|
||||
x = [9, z, 5, y, "foo"];
|
||||
t.call(x, z, 5, "foo");
|
||||
a.deep(x, [9, y], "More than one argument");
|
||||
};
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x = [], y = {}, z = {};
|
||||
a.deep(t.call(x, y), [], "Empty");
|
||||
a.not(t.call(x), x, "Returns copy");
|
||||
a.deep(t.call([1], y), [1], "One");
|
||||
a.deep(t.call([1, "raz"], y), [1, y, "raz"], "One");
|
||||
a.deep(t.call([1, "raz", x], y), [1, y, "raz", y, x], "More");
|
||||
x = new Array(1000);
|
||||
x[23] = 2;
|
||||
x[3453] = "raz";
|
||||
x[500] = z;
|
||||
a.deep(t.call(x, y), [2, y, z, y, "raz"], "Sparse");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../../array/#/slice/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
var SubArray = require("../../../../array/_sub-array-dummy-safe");
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var arr, x = {}, subArr, result;
|
||||
|
||||
arr = ["foo", undefined, 0, "2d", false, x, null];
|
||||
|
||||
a.deep(t.call(arr, 2, 4), [0, "2d"], "Plain array: result");
|
||||
|
||||
subArr = new SubArray("foo", undefined, 0, "2d", false, x, null);
|
||||
|
||||
result = t.call(subArr, 2, 4);
|
||||
a(result instanceof SubArray, true, "Instance of subclass");
|
||||
a.deep(result, [0, "2d"], "Subclass: result");
|
||||
};
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"__generic": function (t, a) {
|
||||
var count = 0, first, last, x, icount = this.length;
|
||||
t.call(this, function (item, index, col) {
|
||||
++count;
|
||||
if (!first) {
|
||||
first = item;
|
||||
}
|
||||
last = item;
|
||||
x = col;
|
||||
a(index, --icount, "Index");
|
||||
});
|
||||
a(count, this.length, "Iterated");
|
||||
a(first, this[this.length - 1], "First is last");
|
||||
a(last, this[0], "Last is first");
|
||||
a.deep(x, Object(this), "Collection as third argument"); // Jslint: skip
|
||||
},
|
||||
"": function (t, a) {
|
||||
var x = {}, y, count;
|
||||
t.call(
|
||||
[1],
|
||||
function () {
|
||||
y = this;
|
||||
},
|
||||
x
|
||||
);
|
||||
a(y, x, "Scope");
|
||||
y = 0;
|
||||
t.call([3, 4, 4], function (a, i) {
|
||||
y += i;
|
||||
});
|
||||
a(y, 3, "Indexes");
|
||||
|
||||
x = [1, 3];
|
||||
x[5] = "x";
|
||||
y = 0;
|
||||
count = 0;
|
||||
a(
|
||||
t.call(x, function (a, i) {
|
||||
++count;
|
||||
y += i;
|
||||
}),
|
||||
false,
|
||||
"Return"
|
||||
);
|
||||
a(y, 6, "Misssing Indexes");
|
||||
a(count, 3, "Misssing Indexes, count");
|
||||
|
||||
count = 0;
|
||||
a(
|
||||
t.call([-2, -3, -4, 2, -5], function (item) {
|
||||
++count;
|
||||
return item > 0;
|
||||
}),
|
||||
true,
|
||||
"Return"
|
||||
);
|
||||
a(count, 2, "Break after true is returned");
|
||||
}
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../../array/#/splice/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
var SubArray = require("../../../../array/_sub-array-dummy-safe");
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var arr, x = {}, subArr, result;
|
||||
|
||||
arr = ["foo", undefined, 0, "2d", false, x, null];
|
||||
|
||||
a.deep(t.call(arr, 2, 2, "bar"), [0, "2d"], "Plain array: result");
|
||||
a.deep(arr, ["foo", undefined, "bar", false, x, null], "Plain array: change");
|
||||
|
||||
subArr = new SubArray("foo", undefined, 0, "2d", false, x, null);
|
||||
|
||||
result = t.call(subArr, 2, 2, "bar");
|
||||
a(result instanceof SubArray, true, "Instance of subclass");
|
||||
a.deep(result, [0, "2d"], "Subclass: result");
|
||||
a.deep(subArr, ["foo", undefined, "bar", false, x, null], "Subclass: change");
|
||||
};
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"__generic": function (t, a) {
|
||||
a(t.call(this).length, 3);
|
||||
},
|
||||
"": function (t, a) {
|
||||
var o, x = {}, y = {}, z = {}, w;
|
||||
o = [1, 2, x, 3, 1, "raz", "1", y, x, "trzy", z, "raz"];
|
||||
|
||||
a.not(w = t.call(o), o, "Returns different object");
|
||||
a.deep(w, [1, 2, x, 3, "raz", "1", y, "trzy", z], "Result");
|
||||
}
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../../array/#/values/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
exports.__generic = function (t, a) {
|
||||
var iterator = t.call(this);
|
||||
a.deep(iterator.next(), { value: "1", done: false });
|
||||
a.deep(iterator.next(), { value: "2", done: false });
|
||||
a.deep(iterator.next(), { value: "3", done: false });
|
||||
a.deep(iterator.next(), { value: undefined, done: true });
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
exports.Array = ["1", "2", "3"];
|
||||
|
||||
exports.Arguments = (function () {
|
||||
return arguments;
|
||||
}("1", "2", "3"));
|
||||
|
||||
exports.String = "123";
|
||||
|
||||
exports.Object = { 0: "1", 1: "2", 2: "3", 3: "4", length: 3 };
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t, "boolean");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isArray = Array.isArray;
|
||||
|
||||
module.exports = function (t) {
|
||||
t(t === null || isArray(t.prototype), true);
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isArray = Array.isArray;
|
||||
|
||||
module.exports = function (t) {
|
||||
t(t === null || isArray(t.prototype), true);
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../array/from/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
// Some tests taken from: https://github.com/mathiasbynens/Array.from/blob/master/tests/tests.js
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var o = [1, 2, 3], MyType;
|
||||
a.not(t(o), o, "Array");
|
||||
a.deep(t(o), o, "Array: same content");
|
||||
a.deep(t("12r3v"), ["1", "2", "r", "3", "v"], "String");
|
||||
a.deep(
|
||||
t(
|
||||
(function () {
|
||||
return arguments;
|
||||
})(3, o, "raz")
|
||||
),
|
||||
[3, o, "raz"],
|
||||
"Arguments"
|
||||
);
|
||||
a.deep(
|
||||
t(
|
||||
(function () {
|
||||
return arguments;
|
||||
})(3)
|
||||
),
|
||||
[3],
|
||||
"Arguments with one numeric value"
|
||||
);
|
||||
|
||||
a.deep(t({ 0: "raz", 1: "dwa", length: 2 }), ["raz", "dwa"], "Other");
|
||||
|
||||
a.deep(
|
||||
t(
|
||||
o,
|
||||
function (val) {
|
||||
return (val + 2) * 10;
|
||||
},
|
||||
10
|
||||
),
|
||||
[30, 40, 50],
|
||||
"Mapping"
|
||||
);
|
||||
|
||||
a.throws(
|
||||
function () {
|
||||
t();
|
||||
},
|
||||
TypeError,
|
||||
"Undefined"
|
||||
);
|
||||
a.deep(t(3), [], "Primitive");
|
||||
|
||||
a(t.length, 1, "Length");
|
||||
a.deep(t({ length: 0 }), [], "No values Array-like");
|
||||
a.deep(t({ length: -1 }), [], "Invalid length Array-like");
|
||||
a.deep(t({ length: -Infinity }), [], "Invalid length Array-like #2");
|
||||
a.throws(
|
||||
function () {
|
||||
t(undefined);
|
||||
},
|
||||
TypeError,
|
||||
"Undefined"
|
||||
);
|
||||
a.throws(
|
||||
function () {
|
||||
t(null);
|
||||
},
|
||||
TypeError,
|
||||
"Null"
|
||||
);
|
||||
a.deep(t(false), [], "Boolean");
|
||||
a.deep(t(-Infinity), [], "Inifity");
|
||||
a.deep(t(-0), [], "-0");
|
||||
a.deep(t(+0), [], "+0");
|
||||
a.deep(t(1), [], "1");
|
||||
a.deep(t(Number(Infinity)), [], "+Infinity");
|
||||
a.deep(t({}), [], "Plain object");
|
||||
a.deep(t({ length: 1 }), [undefined], "Sparse array-like");
|
||||
a.deep(
|
||||
t({ 0: "a", 1: "b", length: 2 }, function (x) {
|
||||
return x + x;
|
||||
}),
|
||||
["aa", "bb"],
|
||||
"Map"
|
||||
);
|
||||
a.deep(
|
||||
t(
|
||||
{ 0: "a", 1: "b", length: 2 },
|
||||
function () {
|
||||
return String(this);
|
||||
},
|
||||
undefined
|
||||
),
|
||||
["undefined", "undefined"],
|
||||
"Map context"
|
||||
);
|
||||
a.deep(
|
||||
t(
|
||||
{ 0: "a", 1: "b", length: 2 },
|
||||
function () {
|
||||
return String(this);
|
||||
},
|
||||
"x"
|
||||
),
|
||||
["x", "x"],
|
||||
"Map primitive context"
|
||||
);
|
||||
a.throws(
|
||||
function () {
|
||||
t({}, "foo", "x");
|
||||
},
|
||||
TypeError,
|
||||
"Non callable for map"
|
||||
);
|
||||
|
||||
a.deep(t({ length: 1, 0: "a" }), ["a"], "Null context");
|
||||
|
||||
a(t({ __proto__: { 0: "abc", length: 1 } })[0], "abc", "Values on prototype");
|
||||
|
||||
a.throws(
|
||||
function () {
|
||||
t.call(function () {
|
||||
return Object.freeze({});
|
||||
}, {});
|
||||
},
|
||||
TypeError,
|
||||
"Contructor producing freezed objects"
|
||||
);
|
||||
|
||||
// Ensure no setters are called for the indexes
|
||||
// Ensure no setters are called for the indexes
|
||||
MyType = function () {};
|
||||
Object.defineProperty(MyType.prototype, "0", {
|
||||
set: function (x) {
|
||||
throw new Error("Setter called: " + x);
|
||||
}
|
||||
});
|
||||
a.deep(t.call(MyType, { 0: "abc", length: 1 }), { 0: "abc", length: 1 }, "Defined not set");
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x = {}, y = {};
|
||||
a.deep(t(3), [undefined, undefined, undefined], "Just length");
|
||||
a.deep(t(0, "x"), [], "No repeat");
|
||||
a.deep(t(1, x, y), [x], "Arguments length larger than repeat number");
|
||||
a.deep(t(3, x), [x, x, x], "Single argument");
|
||||
a.deep(t(5, x, y), [x, y, x, y, x], "Many arguments");
|
||||
};
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
var SubArray = require("../../array/_sub-array-dummy-safe");
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var arr = [1, 2, 3];
|
||||
a(t(arr), true, "Array");
|
||||
a(t(null), false, "Null");
|
||||
a(t(), false, "Undefined");
|
||||
a(t("234"), false, "String");
|
||||
a(t(23), false, "Number");
|
||||
a(t({}), false, "Plain object");
|
||||
a(t({ length: 1, 0: "raz" }), false, "Array-like");
|
||||
a(t(Object.create(arr)), false, "Array extension");
|
||||
if (!SubArray) return;
|
||||
a(t(new SubArray(23)), false, "Subclass instance");
|
||||
a(t(Array.prototype), false, "Array.prototype");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../array/of/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
/* eslint no-useless-call: "off" */
|
||||
// Most tests taken from https://github.com/mathiasbynens/Array.of/blob/master/tests/tests.js
|
||||
// Thanks @mathiasbynens
|
||||
|
||||
"use strict";
|
||||
|
||||
var defineProperty = Object.defineProperty;
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x = {}, testObject, MyType;
|
||||
|
||||
a.deep(t(), [], "No arguments");
|
||||
a.deep(t(3), [3], "One numeric argument");
|
||||
a.deep(t(3, "raz", null, x, undefined), [3, "raz", null, x, undefined], "Many arguments");
|
||||
|
||||
a(t.length, 0, "Length");
|
||||
|
||||
a.deep(t("abc"), ["abc"], "String");
|
||||
a.deep(t(undefined), [undefined], "Undefined");
|
||||
a.deep(t(null), [null], "Null");
|
||||
a.deep(t(false), [false], "Boolean");
|
||||
a.deep(t(-Infinity), [-Infinity], "Infinity");
|
||||
a.deep(t(-0), [-0], "-0");
|
||||
a.deep(t(+0), [+0], "+0");
|
||||
a.deep(t(1), [1], "1");
|
||||
a.deep(t(1, 2, 3), [1, 2, 3], "Numeric args");
|
||||
a.deep(t(Number(Infinity)), [Number(Infinity)], "+Infinity");
|
||||
a.deep(
|
||||
t({ 0: "a", 1: "b", 2: "c", length: 3 }),
|
||||
[{ 0: "a", 1: "b", 2: "c", length: 3 }],
|
||||
"Array like"
|
||||
);
|
||||
a.deep(
|
||||
t(undefined, null, false, -Infinity, -0, +0, 1, 2, Number(Infinity)),
|
||||
[undefined, null, false, -Infinity, -0, +0, 1, 2, Number(Infinity)],
|
||||
"Falsy arguments"
|
||||
);
|
||||
|
||||
a.h1("Null context");
|
||||
a.deep(t.call(null, "abc"), ["abc"], "String");
|
||||
a.deep(t.call(null, undefined), [undefined], "Undefined");
|
||||
a.deep(t.call(null, null), [null], "Null");
|
||||
a.deep(t.call(null, false), [false], "Boolean");
|
||||
a.deep(t.call(null, -Infinity), [-Infinity], "-Infinity");
|
||||
a.deep(t.call(null, -0), [-0], "-0");
|
||||
a.deep(t.call(null, +0), [+0], "+0");
|
||||
a.deep(t.call(null, 1), [1], "1");
|
||||
a.deep(t.call(null, 1, 2, 3), [1, 2, 3], "Numeric");
|
||||
a.deep(t.call(null, Number(Infinity)), [Number(Infinity)], "+Infinity");
|
||||
a.deep(
|
||||
t.call(null, { 0: "a", 1: "b", 2: "c", length: 3 }),
|
||||
[{ 0: "a", 1: "b", 2: "c", length: 3 }],
|
||||
"Array-like"
|
||||
);
|
||||
a.deep(
|
||||
t.call(null, undefined, null, false, -Infinity, -0, +0, 1, 2, Number(Infinity)),
|
||||
[undefined, null, false, -Infinity, -0, +0, 1, 2, Number(Infinity)],
|
||||
"Falsy"
|
||||
);
|
||||
|
||||
a.h1("Other constructor context");
|
||||
a.deep(t.call(Object, 1, 2, 3), { 0: 1, 1: 2, 2: 3, length: 3 }, "Many arguments");
|
||||
|
||||
testObject = Object(3);
|
||||
testObject[0] = 1;
|
||||
testObject[1] = 2;
|
||||
testObject[2] = 3;
|
||||
testObject.length = 3;
|
||||
a.deep(t.call(Object, 1, 2, 3), testObject, "Test object");
|
||||
a(t.call(Object).length, 0, "No arguments");
|
||||
a.throws(
|
||||
function () {
|
||||
t.call(function () {
|
||||
return Object.freeze({});
|
||||
});
|
||||
},
|
||||
TypeError,
|
||||
"Frozen instance"
|
||||
);
|
||||
|
||||
// Ensure no setters are called for the indexes
|
||||
MyType = function () {};
|
||||
defineProperty(MyType.prototype, "0", {
|
||||
set: function (x) {
|
||||
throw new Error("Setter called: " + x);
|
||||
}
|
||||
});
|
||||
a.deep(t.call(MyType, "abc"), { 0: "abc", length: 1 }, "Define, not set");
|
||||
};
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var o = [1, 2, 3];
|
||||
a(t(o), o, "Array");
|
||||
a.deep(t("12r3v"), ["1", "2", "r", "3", "v"], "String");
|
||||
a.deep(
|
||||
t(
|
||||
(function () {
|
||||
return arguments;
|
||||
})(3, o, "raz")
|
||||
),
|
||||
[3, o, "raz"],
|
||||
"Arguments"
|
||||
);
|
||||
a.deep(
|
||||
t(
|
||||
(function () {
|
||||
return arguments;
|
||||
})(3)
|
||||
),
|
||||
[3],
|
||||
"Arguments with one numeric value"
|
||||
);
|
||||
|
||||
a.deep(t({ 0: "raz", 1: "dwa", length: 2 }), ["raz", "dwa"], "Other");
|
||||
};
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x;
|
||||
a.throws(function () {
|
||||
t();
|
||||
}, TypeError, "Undefined");
|
||||
a.throws(function () {
|
||||
t(null);
|
||||
}, TypeError, "Null");
|
||||
a.throws(function () {
|
||||
t(0);
|
||||
}, TypeError, "Number");
|
||||
a.throws(function () {
|
||||
t(true);
|
||||
}, TypeError, "Boolean");
|
||||
a.throws(function () {
|
||||
t("raz");
|
||||
}, TypeError, "String");
|
||||
a.throws(function () {
|
||||
t(function () {});
|
||||
}, TypeError, "Function");
|
||||
a.throws(function () {
|
||||
t({});
|
||||
}, TypeError, "Object");
|
||||
a.throws(function () {
|
||||
t({ length: 0 });
|
||||
}, TypeError, "Array-like");
|
||||
a(t(x = []), x, "Array");
|
||||
};
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t("arar"), false, "String");
|
||||
a(t(12), false, "Number");
|
||||
a(t(false), true, "Boolean");
|
||||
a(t(new Boolean(false)), true, "Boolean object");
|
||||
a(t(new Date()), false, "Date");
|
||||
a(t(new String("raz")), false, "String object");
|
||||
a(t({}), false, "Plain object");
|
||||
a(t(/a/), false, "Regular expression");
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var o = new Date(), o2;
|
||||
|
||||
o2 = t.call(o);
|
||||
a.not(o, o2, "Different objects");
|
||||
a.ok(o2 instanceof Date, "Instance of Date");
|
||||
a(o.getTime(), o2.getTime(), "Same time");
|
||||
};
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t.call(new Date(2001, 0, 1)), 31, "January");
|
||||
a(t.call(new Date(2001, 1, 1)), 28, "February");
|
||||
a(t.call(new Date(2000, 1, 1)), 29, "February (leap)");
|
||||
a(t.call(new Date(2001, 2, 1)), 31, "March");
|
||||
a(t.call(new Date(2001, 3, 1)), 30, "April");
|
||||
a(t.call(new Date(2001, 4, 1)), 31, "May");
|
||||
a(t.call(new Date(2001, 5, 1)), 30, "June");
|
||||
a(t.call(new Date(2001, 6, 1)), 31, "July");
|
||||
a(t.call(new Date(2001, 7, 1)), 31, "August");
|
||||
a(t.call(new Date(2001, 8, 1)), 30, "September");
|
||||
a(t.call(new Date(2001, 9, 1)), 31, "October");
|
||||
a(t.call(new Date(2001, 10, 1)), 30, "November");
|
||||
a(t.call(new Date(2001, 11, 1)), 31, "December");
|
||||
};
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t.call(new Date(2000, 0, 1, 13, 32, 34, 234)).valueOf(),
|
||||
new Date(2000, 0, 1).valueOf());
|
||||
};
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t.call(new Date(2000, 0, 15, 13, 32, 34, 234)).valueOf(),
|
||||
new Date(2000, 0, 1).valueOf());
|
||||
};
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t.call(new Date(2000, 5, 13, 13, 32, 34, 234)).valueOf(),
|
||||
new Date(2000, 0, 1).valueOf());
|
||||
};
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var dt = new Date(2011, 2, 3, 3, 5, 5, 32);
|
||||
a(t.call(dt, " %Y.%y.%m.%d.%H.%M.%S.%L "), " 2011.11.03.03.03.05.05.032 ");
|
||||
};
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t(12), 12, "Number in range");
|
||||
a(t(12.23), 12, "Rounds number in range");
|
||||
a(t(-12.63), -12, "Rounds negative number in range");
|
||||
a.throws(
|
||||
function () {
|
||||
t(NaN);
|
||||
},
|
||||
TypeError,
|
||||
"Throws on invalid"
|
||||
);
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t("arar"), false, "String");
|
||||
a(t(12), false, "Number");
|
||||
a(t(true), false, "Boolean");
|
||||
a(t(new Date()), true, "Date");
|
||||
a(t(new String("raz")), false, "String object");
|
||||
a(t({}), false, "Plain object");
|
||||
};
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t("arar"), false, "String");
|
||||
a(t(12), true, "Number in range");
|
||||
a(t(true), true, "Boolean");
|
||||
a(t(new Date()), true, "Date");
|
||||
a(t({}), false, "Plain object");
|
||||
a(t(NaN), false, "NaN");
|
||||
a(t(Infinity), false, "Infinity");
|
||||
a(t(8.64e17), false, "Beyond range");
|
||||
a(t(8.64e15), true, "Below range");
|
||||
a(t(-8.64e17), false, "Negative beyond range");
|
||||
a(t(-8.64e15), true, "Negative below range");
|
||||
};
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var d = new Date();
|
||||
a(t(d), d, "Date");
|
||||
a.throws(function () {
|
||||
t({});
|
||||
}, "Object");
|
||||
a.throws(function () {
|
||||
t({ valueOf: function () {
|
||||
return 20;
|
||||
} });
|
||||
}, "Number object");
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var e = new Error();
|
||||
try {
|
||||
t.call(e);
|
||||
} catch (e2) {
|
||||
a(e2, e);
|
||||
}
|
||||
};
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var T = t, err = new T("My Error", "MY_ERROR", { errno: 123 });
|
||||
a(err instanceof Error, true, "Instance of error");
|
||||
a(err.constructor, Error, "Constructor");
|
||||
a(err.name, "Error", "Name");
|
||||
a(String(err), "Error: My Error", "String representation");
|
||||
a(err.code, "MY_ERROR", "Code");
|
||||
a(err.errno, 123, "Errno");
|
||||
a(typeof err.stack, "string", "Stack trace");
|
||||
};
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t(), false, "Undefined");
|
||||
a(t(1), false, "Primitive");
|
||||
a(t({}), false, "Objectt");
|
||||
a(t({ toString: function () {
|
||||
return "[object Error]";
|
||||
} }), false,
|
||||
"Fake error");
|
||||
a(t(new Error()), true, "Error");
|
||||
a(t(new EvalError()), true, "EvalError");
|
||||
a(t(new RangeError()), true, "RangeError");
|
||||
a(t(new ReferenceError()), true, "ReferenceError");
|
||||
a(t(new SyntaxError()), true, "SyntaxError");
|
||||
a(t(new TypeError()), true, "TypeError");
|
||||
a(t(new URIError()), true, "URIError");
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var e = new Error();
|
||||
a(t(e), e, "Error");
|
||||
a.throws(function () {
|
||||
t({});
|
||||
}, "Other");
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
var f = function (a, b) { return ["a", arguments.length, a, b]; }
|
||||
, g = function (a) { return ["b", arguments.length].concat(a); }
|
||||
, h = function (a) { return ["c", arguments.length].concat(a); };
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a.deep(t.call(h, g, f)(1, 2), ["c", 1, "b", 1, "a", 2, 1, 2]);
|
||||
a.deep(t(h, g, f)(1, 2), ["c", 1, "b", 1, "a", 2, 1, 2]);
|
||||
};
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var foo = "raz", bar = "dwa";
|
||||
// eslint-disable-next-line func-names
|
||||
var fn = function marko(a, b) {
|
||||
return this + a + b + foo + bar;
|
||||
};
|
||||
var result, o = {};
|
||||
|
||||
fn.prototype = o;
|
||||
|
||||
fn.foo = "raz";
|
||||
|
||||
result = t.call(fn);
|
||||
|
||||
a(result.length, fn.length, "Length");
|
||||
a(result.name, fn.name, "Length");
|
||||
a(result.call("marko", "el", "fe"), "markoelferazdwa", "Body");
|
||||
a(result.prototype, fn.prototype, "Prototype");
|
||||
a(result.foo, fn.foo, "Custom property");
|
||||
};
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
|
||||
var toArray = require("../../../array/to-array")
|
||||
|
||||
, f = function () {
|
||||
return toArray(arguments);
|
||||
};
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x, y = {}, z;
|
||||
a.deep(t.call(f, 0, 1, 2)(3), [], "0 arguments");
|
||||
x = t.call(f, 5, {});
|
||||
a(x.length, 5, "Length #1");
|
||||
z = x(1, 2);
|
||||
a(z.length, 3, "Length #2");
|
||||
z = z(3, 4);
|
||||
a(z.length, 1, "Length #1");
|
||||
a.deep(z(5, 6), [1, 2, 3, 4, 5], "Many arguments");
|
||||
a.deep(x(8, 3)(y, 45)("raz", 6), [8, 3, y, 45, "raz"], "Many arguments #2");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t.call(function () {
|
||||
return arguments.length;
|
||||
})(1, 2, 3), 0);
|
||||
};
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
var nextTick = require("next-tick");
|
||||
|
||||
module.exports = function (t, a, d) {
|
||||
var wasInvoked = false, args = [{}, {}], context = {};
|
||||
var target = t.call(function () {
|
||||
a(this, context);
|
||||
a.deep(arguments, args);
|
||||
wasInvoked = true;
|
||||
});
|
||||
|
||||
nextTick(function () {
|
||||
a(wasInvoked, false);
|
||||
target.apply(context, args);
|
||||
a(wasInvoked, false);
|
||||
nextTick(function () {
|
||||
a(wasInvoked, true);
|
||||
d();
|
||||
});
|
||||
});
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
var identity = require("../../../function/identity")
|
||||
, noop = require("../../../function/noop");
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t.call(identity)(""), true, "Falsy");
|
||||
a(t.call(noop)(), true, "Undefined");
|
||||
a(t.call(identity)({}), false, "Any object");
|
||||
a(t.call(identity)(true), false, "True");
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
var toArray = require("../../../array/to-array")
|
||||
|
||||
, f = function () {
|
||||
return toArray(arguments);
|
||||
};
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a.deep(t.call(f, 1)(2, 3), [1, 2, 3]);
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
var f = function (a, b) {
|
||||
return this[a] + this[b];
|
||||
}
|
||||
, o = { a: 3, b: 4 };
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t.call(f).call(o, ["a", "b"]), 7);
|
||||
};
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/* eslint no-eval: "off" */
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a.deep(
|
||||
t.call(function (a, b) {
|
||||
return this[a] + this[b];
|
||||
}),
|
||||
{ args: "a, b", body: "\n\t\t\treturn this[a] + this[b];\n\t\t" }
|
||||
);
|
||||
a.deep(t.call(function () {}), { args: "", body: "" });
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
a.deep(t.call(function (raz) {}), { args: "raz", body: "" });
|
||||
a.deep(
|
||||
t.call(function () {
|
||||
Object();
|
||||
}),
|
||||
{ args: "", body: "\n\t\t\tObject();\n\t\t" }
|
||||
);
|
||||
|
||||
try {
|
||||
eval("(() => {})");
|
||||
} catch (e) {
|
||||
// Non ES2015 env
|
||||
return;
|
||||
}
|
||||
|
||||
a.deep(t.call(eval("(() => {})")), { args: "", body: "" });
|
||||
a.deep(t.call(eval("((elo) => foo)")), { args: "elo", body: "foo" });
|
||||
a.deep(t.call(eval("(elo => foo)")), { args: "elo", body: "foo" });
|
||||
a.deep(t.call(eval("((elo, bar) => foo())")), { args: "elo, bar", body: "foo()" });
|
||||
};
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var foo = "raz", bar = "dwa"
|
||||
, fn = function (a, b) {
|
||||
return this + a + b + foo + bar;
|
||||
}
|
||||
, result;
|
||||
|
||||
result = t(fn, 3);
|
||||
a(result.call("marko", "el", "fe"), "markoelferazdwa", "Content");
|
||||
a(result.length, 3, "Length");
|
||||
a(result.prototype, fn.prototype, "Prototype");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var o = {};
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t(o)(), o);
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var o = {};
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t(o), o);
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
var constant = require("../../function/constant")
|
||||
|
||||
, o = { b: constant("c") };
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t("b")(o), "c");
|
||||
};
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var args, dummy;
|
||||
args = (function () {
|
||||
return arguments;
|
||||
}());
|
||||
dummy = { 0: 1, 1: 2 };
|
||||
Object.defineProperty(dummy, "length", { value: 2 });
|
||||
a(t(args), true, "Arguments");
|
||||
a(t(dummy), false, "Dummy");
|
||||
a(t([]), false, "Array");
|
||||
};
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
var o = { call: Function.prototype.call, apply: Function.prototype.apply };
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t(function () {}), true, "Function is function");
|
||||
a(t(o), false, "Plain object is not function");
|
||||
};
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(1, 2, 3), "undefined");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var o = { foo: "bar" };
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t("foo")(o), o.foo);
|
||||
};
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var f = function () {};
|
||||
a(t(f), f, "Function");
|
||||
// eslint-disable-next-line no-new-func
|
||||
f = new Function();
|
||||
a(t(f), f, "Function");
|
||||
a.throws(function () {
|
||||
t({});
|
||||
}, "Object");
|
||||
a.throws(function () {
|
||||
t(/re/);
|
||||
}, "RegExp");
|
||||
a.throws(function () {
|
||||
t({
|
||||
call: function () {
|
||||
return 20;
|
||||
}
|
||||
});
|
||||
}, "Plain object");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a.ok(t && typeof t === "object");
|
||||
a(typeof t.Array, "function");
|
||||
a("__global__" in Object.prototype, false);
|
||||
};
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
var ArrayIterator = require("es6-iterator/array")
|
||||
|
||||
, slice = Array.prototype.slice;
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var i = 0, x = ["raz", "dwa", "trzy"], y = {};
|
||||
t(x, function () {
|
||||
a.deep(slice.call(arguments, 0, 1), [x[i]], "Array " + i + "#");
|
||||
a(this, y, "Array: context: " + i++ + "#");
|
||||
}, y);
|
||||
i = 0;
|
||||
t((function () {
|
||||
return arguments;
|
||||
}("raz", "dwa", "trzy")), function () {
|
||||
a.deep(slice.call(arguments, 0, 1), [x[i]], "Arguments" + i + "#");
|
||||
a(this, y, "Arguments: context: " + i++ + "#");
|
||||
}, y);
|
||||
i = 0;
|
||||
t({ 0: "raz", 1: "dwa", 2: "trzy", length: 3 }, function () {
|
||||
a.deep(slice.call(arguments, 0, 1), [x[i]], "Array-like" + i + "#");
|
||||
a(this, y, "Array-like: context: " + i++ + "#");
|
||||
}, y);
|
||||
i = 0;
|
||||
t(x = "foo", function () {
|
||||
a.deep(slice.call(arguments, 0, 1), [x[i]], "String " + i + "#");
|
||||
a(this, y, "Regular String: context: " + i++ + "#");
|
||||
}, y);
|
||||
i = 0;
|
||||
x = ["r", "💩", "z"];
|
||||
t("r💩z", function () {
|
||||
a.deep(slice.call(arguments, 0, 1), [x[i]], "String " + i + "#");
|
||||
a(this, y, "Unicode String: context: " + i++ + "#");
|
||||
}, y);
|
||||
i = 0;
|
||||
t(new ArrayIterator(x), function () {
|
||||
a.deep(slice.call(arguments, 0, 1), [x[i]], "Iterator " + i + "#");
|
||||
a(this, y, "Iterator: context: " + i++ + "#");
|
||||
}, y);
|
||||
|
||||
};
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
var iteratorSymbol = require("es6-symbol").iterator;
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x;
|
||||
a(t([]), true, "Array");
|
||||
a(t(""), true, "String");
|
||||
a(
|
||||
t(
|
||||
(function () {
|
||||
return arguments;
|
||||
})()
|
||||
),
|
||||
true,
|
||||
"Arguments"
|
||||
);
|
||||
a(t({ length: 0 }), true, "List object");
|
||||
a(t(function () {}), false, "Function");
|
||||
a(t({}), false, "Plain object");
|
||||
a(t(/raz/), false, "Regexp");
|
||||
a(t(), false, "No argument");
|
||||
a(t(null), false, "Null");
|
||||
a(t(undefined), false, "Undefined");
|
||||
x = {};
|
||||
x[iteratorSymbol] = function () {};
|
||||
a(t(x), true, "Iterable");
|
||||
};
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
|
||||
var iteratorSymbol = require("es6-symbol").iterator;
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x;
|
||||
a.throws(function () {
|
||||
t(0);
|
||||
}, TypeError, "0");
|
||||
a.throws(function () {
|
||||
t(false);
|
||||
}, TypeError, "false");
|
||||
a.throws(function () {
|
||||
t("");
|
||||
}, TypeError, "String");
|
||||
a.throws(function () {
|
||||
t({});
|
||||
}, TypeError, "Plain Object");
|
||||
a.throws(function () {
|
||||
t(function () {});
|
||||
}, TypeError, "Function");
|
||||
a(t(x = new String("raz")), x, "String object"); // Jslint: ignore
|
||||
|
||||
a(t(x = { length: 1 }), x, "Array like");
|
||||
a.throws(function () {
|
||||
t();
|
||||
}, TypeError, "Undefined");
|
||||
a.throws(function () {
|
||||
t(null);
|
||||
}, TypeError, "null");
|
||||
x = {};
|
||||
x[iteratorSymbol] = function () {};
|
||||
a(t(x), x, "Iterable");
|
||||
};
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
|
||||
var iteratorSymbol = require("es6-symbol").iterator;
|
||||
|
||||
module.exports = function (t, a) {
|
||||
var x;
|
||||
a.throws(function () {
|
||||
t(0);
|
||||
}, TypeError, "0");
|
||||
a.throws(function () {
|
||||
t(false);
|
||||
}, TypeError, "false");
|
||||
a(t(""), "", "''");
|
||||
a.throws(function () {
|
||||
t({});
|
||||
}, TypeError, "Plain Object");
|
||||
a.throws(function () {
|
||||
t(function () {});
|
||||
}, TypeError, "Function");
|
||||
a(t(x = new String("raz")), x, "String object"); // Jslint: ignore
|
||||
|
||||
a(t(x = { length: 1 }), x, "Array like");
|
||||
a.throws(function () {
|
||||
t();
|
||||
}, TypeError, "Undefined");
|
||||
a.throws(function () {
|
||||
t(null);
|
||||
}, TypeError, "null");
|
||||
x = {};
|
||||
x[iteratorSymbol] = function () {};
|
||||
a(t(x), x, "Iterable");
|
||||
};
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t({ foo: "bar" }), JSON.stringify({ foo: "bar" }));
|
||||
a(t({ foo: { elo: 12 } }), "{\"foo\":{\"elo\":12}}");
|
||||
a(t({ foo: { elo: 12,
|
||||
mel: {
|
||||
toJSON: function () {
|
||||
throw new Error("Nu nu!");
|
||||
}
|
||||
} } }), "{\"foo\":{\"elo\":12}}");
|
||||
a(t({ foo: { elo: 12 },
|
||||
mel: {
|
||||
toJSON: function () {
|
||||
throw new Error("Nu nu!");
|
||||
}
|
||||
} }), "{\"foo\":{\"elo\":12}}");
|
||||
a(t({ foo: { elo: 12 },
|
||||
mel: [
|
||||
"raz", {
|
||||
toJSON: function () {
|
||||
throw new Error("Nu nu!");
|
||||
}
|
||||
}, 0, 2
|
||||
] }), "{\"foo\":{\"elo\":12},\"mel\":[\"raz\",0,2]}");
|
||||
};
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
// Just sanity check, as real tests are in 'round', 'ceil' and 'floor' variants
|
||||
a(t("round")(55.55, -1), 55.6);
|
||||
};
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a.deep(t(1.337, 8, 23), [63, 171, 34, 209]);
|
||||
};
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a.deep(t([63, 171, 34, 209], 8, 23), 1.3370000123977661);
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../math/acosh/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t({}), NaN, "NaN");
|
||||
a(t(-1), NaN, "Negative");
|
||||
a(t(0), NaN, "Zero");
|
||||
a(t(0.5), NaN, "Below 1");
|
||||
a(t(1), 0, "1");
|
||||
a(t(2), 1.3169578969248166, "Other");
|
||||
a(t(Infinity), Infinity, "Infinity");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../math/asinh/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t({}), NaN, "NaN");
|
||||
a(t(0), 0, "Zero");
|
||||
a(t(Infinity), Infinity, "Infinity");
|
||||
a(t(-Infinity), -Infinity, "-Infinity");
|
||||
a(t(-2), -1.4436354751788103, "Negative");
|
||||
a(t(2), 1.4436354751788103, "Positive");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../math/atanh/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t({}), NaN, "NaN");
|
||||
a(t(-2), NaN, "Less than -1");
|
||||
a(t(2), NaN, "Greater than 1");
|
||||
a(t(-1), -Infinity, "-1");
|
||||
a(t(1), Infinity, "1");
|
||||
a(t(0), 0, "Zero");
|
||||
a(Math.round(t(0.5) * 1e15), 549306144334055, "Other");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../math/cbrt/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t({}), NaN, "NaN");
|
||||
a(t(0), 0, "Zero");
|
||||
a(t(Infinity), Infinity, "Infinity");
|
||||
a(t(-Infinity), -Infinity, "-Infinity");
|
||||
a(t(-1), -1, "-1");
|
||||
a(t(1), 1, "1");
|
||||
a(t(2), 1.2599210498948732, "Ohter");
|
||||
};
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t(55.51, -1), 55.6);
|
||||
a(t(51, 1), 60);
|
||||
a(t(-55.59, -1), -55.5);
|
||||
a(t(-59, 1), -50);
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../math/clz32/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t(1), 31, "1");
|
||||
a(t(1000), 22, "1000");
|
||||
a(t(), 32, "No arguments");
|
||||
a(t(Infinity), 32, "Infinity");
|
||||
a(t(-Infinity), 32, "-Infinity");
|
||||
a(t("foo"), 32, "String");
|
||||
a(t(true), 31, "Boolean");
|
||||
a(t(3.5), 30, "Float");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../math/cosh/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t({}), NaN, "NaN");
|
||||
a(t(0), 1, "Zero");
|
||||
a(t(Infinity), Infinity, "Infinity");
|
||||
a(t(-Infinity), Infinity, "-Infinity");
|
||||
a(t(1), 1.5430806348152437, "1");
|
||||
a(t(Number.MAX_VALUE), Infinity);
|
||||
a(t(-Number.MAX_VALUE), Infinity);
|
||||
a(t(Number.MIN_VALUE), 1);
|
||||
a(t(-Number.MIN_VALUE), 1);
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../math/expm1/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t({}), NaN, "NaN");
|
||||
a(t(0), 0, "Zero");
|
||||
a(t(Infinity), Infinity, "Infinity");
|
||||
a(t(-Infinity), -1, "-Infinity");
|
||||
a(t(1).toFixed(15), "1.718281828459045", "1");
|
||||
};
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t(55.59, -1), 55.5);
|
||||
a(t(59, 1), 50);
|
||||
a(t(-55.51, -1), -55.6);
|
||||
a(t(-51, 1), -60);
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../math/fround/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t({}), NaN, "NaN");
|
||||
a(t(0), 0, "Zero");
|
||||
a(t(Infinity), Infinity, "Infinity");
|
||||
a(t(-Infinity), -Infinity, "-Infinity");
|
||||
a(t(1.337), 1.3370000123977661, "1");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../math/hypot/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t(), 0, "No arguments");
|
||||
a(t(0, -0, 0), 0, "Zeros");
|
||||
a(t(4, NaN, Infinity), Infinity, "Infinity");
|
||||
a(t(4, NaN, -Infinity), Infinity, "Infinity");
|
||||
a(t(4, NaN, 34), NaN, "NaN");
|
||||
a(t(3, 4), 5, "#1");
|
||||
a(t(3, 4, 5), 7.0710678118654755, "#2");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../math/imul/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t(), 0, "No arguments");
|
||||
a(t(0, 0), 0, "Zeros");
|
||||
a(t(2, 4), 8, "#1");
|
||||
a(t(-1, 8), -8, "#2");
|
||||
a(t(0xfffffffe, 5), -10, "#3");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../math/log10/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t({}), NaN, "NaN");
|
||||
a(t(-0.5), NaN, "Less than 0");
|
||||
a(t(0), -Infinity, "0");
|
||||
a(t(1), 0, "1");
|
||||
a(t(Infinity), Infinity, "Infinity");
|
||||
a(t(2), 0.3010299956639812, "Other");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../math/log1p/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t({}), NaN, "NaN");
|
||||
a(t(-1.5), NaN, "Less than -1");
|
||||
a(t(-1), -Infinity, "-1");
|
||||
a(t(0), 0, "0");
|
||||
a(t(Infinity), Infinity, "Infinity");
|
||||
a(t(1), 0.6931471805599453, "Other");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../math/log2/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t({}), NaN, "NaN");
|
||||
a(t(-0.5), NaN, "Less than 0");
|
||||
a(t(0), -Infinity, "0");
|
||||
a(t(1), 0, "1");
|
||||
a(t(Infinity), Infinity, "Infinity");
|
||||
a(t(3).toFixed(15), "1.584962500721156", "Other");
|
||||
};
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t(55.55, -1), 55.6);
|
||||
a(t(55.549, -1), 55.5);
|
||||
a(t(55, 1), 60);
|
||||
a(t(54.9, 1), 50);
|
||||
a(t(-55.55, -1), -55.5);
|
||||
a(t(-55.551, -1), -55.6);
|
||||
a(t(-55, 1), -50);
|
||||
a(t(-55.1, 1), -60);
|
||||
a(t(1.005, -2), 1.01);
|
||||
a(t(-1.005, -2), -1.0);
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../math/sign/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
var is = require("../../../object/is");
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(is(t(0), +0), true, "+0");
|
||||
a(is(t(-0), -0), true, "-0");
|
||||
a(t({}), NaN, true, "NaN");
|
||||
a(t(-234234234), -1, "Negative");
|
||||
a(t(234234234), 1, "Positive");
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var isImplemented = require("../../../math/sinh/is-implemented");
|
||||
|
||||
module.exports = function (a) {
|
||||
a(isImplemented(), true);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./shim");
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(typeof t(), "boolean");
|
||||
};
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a) {
|
||||
a(t({}), NaN, "NaN");
|
||||
a(t(0), 0, "Zero");
|
||||
a(t(Infinity), Infinity, "Infinity");
|
||||
a(t(-Infinity), -Infinity, "-Infinity");
|
||||
a(t(1), 1.1752011936438014, "1");
|
||||
a(t(Number.MAX_VALUE), Infinity);
|
||||
a(t(-Number.MAX_VALUE), -Infinity);
|
||||
a(t(Number.MIN_VALUE), 5e-324);
|
||||
a(t(-Number.MIN_VALUE), -5e-324);
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user