Opal-Estate-Pro/node_modules/memoizee/test/methods.js

46 lines
772 B
JavaScript
Raw Normal View History

2019-09-13 06:27:52 +02:00
/* eslint id-length: 0 */
"use strict";
var d = require("d");
module.exports = function (t, a) {
var value = [], obj = {};
Object.defineProperties(
obj,
t({
someFn: d(
function (x, y) {
a(this, obj);
return x + y;
},
{
refCounter: true,
dispose: function (val) {
value.push(val);
}
}
)
})
);
obj = Object.create(obj);
obj.someFn(3, 7);
obj.someFn(5, 8);
obj.someFn(12, 4);
a.deep(value, [], "Pre");
obj.someFn(5, 8);
obj.someFn.deleteRef(5, 8);
a.deep(value, [], "Pre");
obj.someFn.deleteRef(5, 8);
a.deep(value, [13], "#1");
value = [];
obj.someFn.deleteRef(12, 4);
a.deep(value, [16], "#2");
value = [];
obj.someFn(77, 11);
obj.someFn.clear();
a.deep(value, [10, 88], "Clear all");
};