Sha256: 9a3d69a3f9a451aa09e70d309496bc8adf3e6861d06106e166fe33f2e580e6e3
Contents?: true
Size: 882 Bytes
Versions: 1
Compression:
Stored size: 882 Bytes
Contents
var assert = require('assert'); var burrito = require('../'); exports.microwave = function () { var times = 0; var context = { f : function (x) { return x + 1 }, g : function (x) { return x + 2 }, h : function (x) { return x + 3 }, z : function (x) { times ++; return x * 10; }, }; var res = burrito.microwave('f(g(h(5)))', context, function (node) { if (node.name === 'call') { node.wrap(function (s) { return 'z(' + s + ')'; }); } }); assert.equal(res, (((((5 + 3) * 10) + 2) * 10) + 1) * 10); assert.equal(times, 3); }; exports.emptyContext = function () { var res = burrito.microwave('Math.sin(2)', function (node) { if (node.name === 'num') node.wrap('Math.PI / %s'); }); assert.equal(res, 1); };
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
holmes-0.0.1 | lib/holmes/node_modules/detective/node_modules/burrito/test/microwave.js |