initial commit

This commit is contained in:
air66
2019-07-24 18:16:32 +01:00
commit 5efebf4ded
8591 changed files with 899103 additions and 0 deletions

32
node_modules/es5-ext/test/promise/#/as-callback.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
"use strict";
module.exports = function (t, a) {
if (typeof Promise !== "function") return null;
return {
Success: function (d) {
t.call(
new Promise(function (resolve) {
resolve("foo");
}),
function (error, value) {
a(error, null);
a(value, "foo");
d();
}
);
},
Failure: function (d) {
var error = new Error("Rejection");
t.call(
new Promise(function (resolve, reject) {
reject(error);
}),
function (passedError, value) {
a(passedError, error);
a(value, undefined);
d();
}
);
}
};
};

View File

@@ -0,0 +1,7 @@
"use strict";
var isImplemented = require("../../../../promise/#/finally/is-implemented");
if (typeof Promise !== "function") global.Promise = require("plain-promise");
module.exports = function (a) { a(isImplemented(), true); };

3
node_modules/es5-ext/test/promise/#/finally/index.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
"use strict";
module.exports = require("./shim");

View File

@@ -0,0 +1,5 @@
"use strict";
module.exports = function (t, a) {
a(typeof t(), "boolean");
};

75
node_modules/es5-ext/test/promise/#/finally/shim.js generated vendored Normal file
View File

@@ -0,0 +1,75 @@
"use strict";
var microtaskDelay = require("../../../../function/#/microtask-delay");
if (typeof Promise !== "function") global.Promise = require("plain-promise");
module.exports = function (t, a) {
return {
Success: function (d) {
var invoked;
t.call(Promise.resolve("foo"), function () {
invoked = true;
return "bar";
}).then(
microtaskDelay.call(function (result) {
a(result, "foo");
a(invoked, true);
d();
}, microtaskDelay.call(d))
);
},
Failure: function (d) {
var invoked;
var error = new Error("Some error");
t.call(Promise.reject(error), function () {
invoked = true;
return "bar";
}).then(
microtaskDelay.call(function () {
a.never();
d();
}),
microtaskDelay.call(function (result) {
a(result, error);
a(invoked, true);
d();
})
);
},
SuccessFinallyError: function (d) {
var invoked, finallyError = new Error("Finally error");
t.call(Promise.resolve("foo"), function () {
invoked = true;
throw finallyError;
}).then(
microtaskDelay.call(function () {
a.never();
d();
}),
microtaskDelay.call(function (result) {
a(result, finallyError);
a(invoked, true);
d();
})
);
},
FailureFinallyError: function (d) {
var invoked, finallyError = new Error("Finally error");
t.call(Promise.reject(new Error("Some error")), function () {
invoked = true;
throw finallyError;
}).then(
microtaskDelay.call(function () {
a.never();
d();
}),
microtaskDelay.call(function (result) {
a(result, finallyError);
a(invoked, true);
d();
})
);
}
};
};

3
node_modules/es5-ext/test/promise/.eslintrc.json generated vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"globals": { "Promise": true, "setTimeout": true }
}

52
node_modules/es5-ext/test/promise/lazy.js generated vendored Normal file
View File

@@ -0,0 +1,52 @@
"use strict";
module.exports = function (t) {
if (typeof Promise !== "function") return null; // Run tests only in ES2015+ env
return {
"Delays execution": function (a, d) {
var invoked = false;
var promise = t(function (resolve) {
invoked = true;
setTimeout(function () {
resolve(20);
}, 10);
});
a(invoked, false);
setTimeout(function () {
a(invoked, false);
promise.then(function (value) {
a(value, 20);
setTimeout(d, 0); // Escape error swallowing
});
a(invoked, true);
}, 15);
},
"Passes rejection": function (a, d) {
var promise = t(function (resolve, reject) {
setTimeout(function () {
reject(new Error("Stop"));
}, 10);
});
promise.catch(function (error) {
a(error instanceof Error, true);
a(error.message, "Stop");
setTimeout(d, 0); // Escape error swallowing
});
},
"Passes sync exception": function (a, d) {
var promise = t(function () {
throw new Error("Stop");
});
promise.catch(function (error) {
a(error instanceof Error, true);
a(error.message, "Stop");
setTimeout(d, 0); // Escape error swallowing
});
}
};
};