diff options
Diffstat (limited to 'tools/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/set-prototype-of/shim.js')
-rw-r--r-- | tools/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/set-prototype-of/shim.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/set-prototype-of/shim.js b/tools/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/set-prototype-of/shim.js new file mode 100644 index 0000000000..aec2605cc2 --- /dev/null +++ b/tools/eslint/node_modules/escope/node_modules/es6-weak-map/node_modules/es5-ext/test/object/set-prototype-of/shim.js @@ -0,0 +1,23 @@ +'use strict'; + +var create = require('../../../object/create') + + , getPrototypeOf = Object.getPrototypeOf; + +module.exports = function (t, a) { + var x = {}, y = {}; + + if (t === null) return; + a(t(x, y), x, "Return self object"); + a(getPrototypeOf(x), y, "Object"); + a.throws(function () { t(x); }, TypeError, "Undefined"); + a.throws(function () { t('foo'); }, TypeError, "Primitive"); + a(getPrototypeOf(t(x, null)), t.nullPolyfill || null, "Null"); + x = create(null); + a.h1("Change null prototype"); + a(t(x, y), x, "Result"); + a(getPrototypeOf(x), y, "Prototype"); + a.h1("Set null prototype"); + a(t(y, null), y, "Result"); + a(getPrototypeOf(y), t.nullPolyfill || null, "Prototype"); +}; |