1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- //jshint eqnull:true
- define(function () {
- "use strict";
- function assert (fn) {
- try {
- if (fn()) return;
- } catch (ex) {
- throw new Error("Error:\n" + ex + "in assertion:\n" + fn);
- }
- throw new Error("Assertion failed:\n" + fn);
- }
- assert(function () {
- return !("hasOwnProperty" in Object.create(null));
- });
- assert(function () {
- return new Function("return this")().Object === Object;
- });
- assert(function () {
- return Object.create(new Function("return this")()).Object === Object;
- });
- assert(function () {
- return (function () {
- return this;
- }).apply(void 0) === void 0;
- });
- assert(function () {
- return (function () {
- return this;
- }).apply(null) === null;
- });
- assert(function () {
- return (function () {
- return this;
- }).apply(3) === 3;
- });
- assert(function () {
- return (function () {
- return this;
- }).apply("foo") === "foo";
- });
- assert(function () {
- return (function () {
- return this;
- }).apply(true) === true;
- });
- assert(function () {
- return typeof Promise === "function";
- });
- assert(function () {
- return typeof Promise.resolve === "function";
- });
- assert(function () {
- return typeof Promise.reject === "function";
- });
- assert(function () {
- return typeof new Promise(function () {
- }).then === "function";
- });
- });
|