Sha256: 72836574458e2cfc6a60e9d9837987412e81bff9b757cda4b846e4d6905c0bc0

Contents?: true

Size: 906 Bytes

Versions: 14

Compression:

Stored size: 906 Bytes

Contents

'use strict';

var memoize = require('../..');

require('../ext/dispose');
require('../ext/ref-counter');

module.exports = function (t, a) {
	var value = [], obj = {}, memoized, count = 0, x, y, z;
	t = t(memoize);
	memoized = t(function (arg, x, y) { a(arg, obj); return x + y; },
		{ refCounter: true, dispose: function (val) { value.push(val); } });

	a(memoized(obj, 3, 7), 10);
	a(memoized(obj, 5, 8), 13);
	a(memoized(obj, 12, 4), 16);
	a.deep(value, [], "Pre");
	a(memoized(obj, 5, 8), 13);
	memoized.deleteRef(obj, 5, 8);
	a.deep(value, [], "Pre");
	memoized.deleteRef(obj, 5, 8);
	a.deep(value, [13], "#1");
	value = [];
	memoized.deleteRef(obj, 12, 4);
	a.deep(value, [16], "#2");

	value = [];
	memoized(obj, 77, 11);

	x = {};
	y = {};
	z = {};
	memoized = t(function (arg) { return ++count; });
	a(memoized(x), 1);
	a(memoized(y), 2);
	a(memoized(x), 1);
	a(memoized(z), 3);
	a(count, 3);
};

Version data entries

14 entries across 7 versions & 1 rubygems

Version Path
entangled-0.0.16 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/inquirer/node_modules/cli-color/node_modules/memoizee/test/lib/weak.js
entangled-0.0.16 spec/dummy/public/node_modules/bower/node_modules/inquirer/node_modules/cli-color/node_modules/memoizee/test/lib/weak.js
entangled-0.0.15 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/inquirer/node_modules/cli-color/node_modules/memoizee/test/lib/weak.js
entangled-0.0.15 spec/dummy/public/node_modules/bower/node_modules/inquirer/node_modules/cli-color/node_modules/memoizee/test/lib/weak.js
entangled-0.0.14 spec/dummy/public/node_modules/bower/node_modules/inquirer/node_modules/cli-color/node_modules/memoizee/test/lib/weak.js
entangled-0.0.14 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/inquirer/node_modules/cli-color/node_modules/memoizee/test/lib/weak.js
entangled-0.0.13 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/inquirer/node_modules/cli-color/node_modules/memoizee/test/lib/weak.js
entangled-0.0.13 spec/dummy/public/node_modules/bower/node_modules/inquirer/node_modules/cli-color/node_modules/memoizee/test/lib/weak.js
entangled-0.0.12 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/inquirer/node_modules/cli-color/node_modules/memoizee/test/lib/weak.js
entangled-0.0.12 spec/dummy/public/node_modules/bower/node_modules/inquirer/node_modules/cli-color/node_modules/memoizee/test/lib/weak.js
entangled-0.0.11 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/inquirer/node_modules/cli-color/node_modules/memoizee/test/lib/weak.js
entangled-0.0.11 spec/dummy/public/node_modules/bower/node_modules/inquirer/node_modules/cli-color/node_modules/memoizee/test/lib/weak.js
entangled-0.0.10 spec/dummy/public/node_modules/bower/node_modules/inquirer/node_modules/cli-color/node_modules/memoizee/test/lib/weak.js
entangled-0.0.10 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/inquirer/node_modules/cli-color/node_modules/memoizee/test/lib/weak.js