]> gerrit.simantics Code Review - simantics/district.git/blob - index.js
aec2605cc2661a7f21445631316e4c52a279e6ed
[simantics/district.git] / index.js
1 'use strict';
2
3 var create = require('../../../object/create')
4
5   , getPrototypeOf = Object.getPrototypeOf;
6
7 module.exports = function (t, a) {
8         var x = {}, y = {};
9
10         if (t === null) return;
11         a(t(x, y), x, "Return self object");
12         a(getPrototypeOf(x), y, "Object");
13         a.throws(function () { t(x); }, TypeError, "Undefined");
14         a.throws(function () { t('foo'); }, TypeError, "Primitive");
15         a(getPrototypeOf(t(x, null)), t.nullPolyfill || null, "Null");
16         x = create(null);
17         a.h1("Change null prototype");
18         a(t(x, y), x, "Result");
19         a(getPrototypeOf(x), y, "Prototype");
20         a.h1("Set null prototype");
21         a(t(y, null), y, "Result");
22         a(getPrototypeOf(y), t.nullPolyfill || null, "Prototype");
23 };