aboutsummaryrefslogtreecommitdiff
path: root/node_modules/es5-ext/test
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/es5-ext/test')
-rw-r--r--node_modules/es5-ext/test/object/assign-deep.js12
-rw-r--r--node_modules/es5-ext/test/object/keys/implement.js4
-rw-r--r--node_modules/es5-ext/test/object/keys/is-implemented.js4
-rw-r--r--node_modules/es5-ext/test/object/keys/shim.js8
-rw-r--r--node_modules/es5-ext/test/reg-exp/#/match/shim.js4
-rw-r--r--node_modules/es5-ext/test/safe-to-string.js11
-rw-r--r--node_modules/es5-ext/test/string/format-method.js14
-rw-r--r--node_modules/es5-ext/test/to-short-string-representation.js11
8 files changed, 29 insertions, 39 deletions
diff --git a/node_modules/es5-ext/test/object/assign-deep.js b/node_modules/es5-ext/test/object/assign-deep.js
index 071eeb739..962ac40df 100644
--- a/node_modules/es5-ext/test/object/assign-deep.js
+++ b/node_modules/es5-ext/test/object/assign-deep.js
@@ -10,6 +10,18 @@ module.exports = function (t, a) {
var obj1 = { foo: { bar: 3, marko: true } }
, obj2 = { foo: { elo: 12, marko: false }, miszka: [23] };
+
+ var copyObj1 = JSON.parse(JSON.stringify(obj1)), copyObj2 = JSON.parse(JSON.stringify(obj2));
a.deep(t({}, obj1, obj2), { foo: { bar: 3, marko: false, elo: 12 }, miszka: [23] });
+ // Ensure it's side effects free
+ a.deep(obj1, copyObj1);
+ a.deep(obj2, copyObj2);
+
+ obj1 = [{ foo: "bar" }];
+ var assignedObj = [];
+ t(assignedObj, obj1);
+ a.deep(assignedObj, [{ foo: "bar" }]);
+ // Ensure array items are copied and not passed
+ a.not(assignedObj[0], obj1[0]);
a(t(true), true);
};
diff --git a/node_modules/es5-ext/test/object/keys/implement.js b/node_modules/es5-ext/test/object/keys/implement.js
index d364abed9..3134886dc 100644
--- a/node_modules/es5-ext/test/object/keys/implement.js
+++ b/node_modules/es5-ext/test/object/keys/implement.js
@@ -2,6 +2,4 @@
var isImplemented = require("../../../object/keys/is-implemented");
-module.exports = function (a) {
- a(isImplemented(), true);
-};
+module.exports = function (a) { a(isImplemented(), true); };
diff --git a/node_modules/es5-ext/test/object/keys/is-implemented.js b/node_modules/es5-ext/test/object/keys/is-implemented.js
index 5003e7e93..566411ce2 100644
--- a/node_modules/es5-ext/test/object/keys/is-implemented.js
+++ b/node_modules/es5-ext/test/object/keys/is-implemented.js
@@ -1,5 +1,3 @@
"use strict";
-module.exports = function (t, a) {
- a(typeof t(), "boolean");
-};
+module.exports = function (t, a) { a(typeof t(), "boolean"); };
diff --git a/node_modules/es5-ext/test/object/keys/shim.js b/node_modules/es5-ext/test/object/keys/shim.js
index 47e6547ed..dc09f46bd 100644
--- a/node_modules/es5-ext/test/object/keys/shim.js
+++ b/node_modules/es5-ext/test/object/keys/shim.js
@@ -3,10 +3,6 @@
module.exports = function (t, a) {
a.deep(t({ foo: "bar" }), ["foo"], "Object");
a.deep(t("raz"), ["0", "1", "2"], "Primitive");
- a.throws(function () {
- t();
-}, TypeError, "Undefined");
- a.throws(function () {
- t(null);
-}, TypeError, "Undefined");
+ a.throws(function () { t(); }, TypeError, "Undefined");
+ a.throws(function () { t(null); }, TypeError, "Undefined");
};
diff --git a/node_modules/es5-ext/test/reg-exp/#/match/shim.js b/node_modules/es5-ext/test/reg-exp/#/match/shim.js
index fce094f61..c6fedb57c 100644
--- a/node_modules/es5-ext/test/reg-exp/#/match/shim.js
+++ b/node_modules/es5-ext/test/reg-exp/#/match/shim.js
@@ -1,8 +1,6 @@
"use strict";
module.exports = function (t, a) {
- var result = ["foo"];
- result.index = 0;
- result.input = "foobar";
+ var result = "foobar".match(/foo/);
a.deep(t.call(/foo/, "foobar"), result);
};
diff --git a/node_modules/es5-ext/test/safe-to-string.js b/node_modules/es5-ext/test/safe-to-string.js
index 1e2d7e13e..8f545e5b7 100644
--- a/node_modules/es5-ext/test/safe-to-string.js
+++ b/node_modules/es5-ext/test/safe-to-string.js
@@ -5,15 +5,8 @@ module.exports = function (t, a) {
a(t(null), "null");
a(t(10), "10");
a(t("str"), "str");
- a(
- t({
- toString: function () {
- return "miszka";
- }
- }),
- "miszka"
- );
+ a(t({ toString: function () { return "miszka"; } }), "miszka");
// eslint-disable-next-line symbol-description
if (typeof Symbol === "function") a(t(Symbol()), "Symbol()");
- a(t(Object.create(null)), "<non-stringifiable value>");
+ a(t(Object.create(null)), "<Non-coercible to string value>");
};
diff --git a/node_modules/es5-ext/test/string/format-method.js b/node_modules/es5-ext/test/string/format-method.js
index 69e93de63..d0c216b46 100644
--- a/node_modules/es5-ext/test/string/format-method.js
+++ b/node_modules/es5-ext/test/string/format-method.js
@@ -1,12 +1,14 @@
"use strict";
module.exports = function (t, a) {
- t = t({ a: "A",
-aa: "B",
-ab: "C",
-b: "D",
+ t = t({
+ a: "A",
+ aa: "B",
+ ab: "C",
+ b: "D",
c: function () {
- return ++this.a;
-} });
+ return ++this.a;
+ }
+ });
a(t.call({ a: 0 }, " %a%aab%abb%b\\%aa%ab%c%c "), " ABbCbD%aaC12 ");
};
diff --git a/node_modules/es5-ext/test/to-short-string-representation.js b/node_modules/es5-ext/test/to-short-string-representation.js
index ea9a06d89..cac8d8701 100644
--- a/node_modules/es5-ext/test/to-short-string-representation.js
+++ b/node_modules/es5-ext/test/to-short-string-representation.js
@@ -7,17 +7,10 @@ module.exports = function (t, a) {
a(t(null), "null");
a(t(10), "10");
a(t("str"), "str");
- a(
- t({
- toString: function () {
- return "miszka";
- }
- }),
- "miszka"
- );
+ a(t({ toString: function () { return "miszka"; } }), "miszka");
// eslint-disable-next-line symbol-description
if (typeof Symbol === "function") a(t(Symbol()), "Symbol()");
- a(t(Object.create(null)), "<non-stringifiable value>");
+ a(t(Object.create(null)), "<Non-coercible to string value>");
a(t(repeat.call("a", 300)), repeat.call("a", 99) + "…");
a(t("mar\ntoo\nfar"), "mar\\ntoo\\nfar");
};