Sha256: 3923943fe590c2ce14fa925801751fe31b27d45030270404815cb34ee5c2b390

Contents?: true

Size: 773 Bytes

Versions: 1

Compression:

Stored size: 773 Bytes

Contents

var assert = require('assert');
var burrito = require('../');

exports.checkParent = function () {
    var src = 'Math.tan(0) + Math.sin(0)';
    
    var res = burrito.microwave(src, function (node) {
        if (node.name === 'binary') {
            node.wrap('%a - %b');
        }
        else if (node.name === 'num') {
            assert.equal(node.parent().value[0][0], 'dot');
            
            var fn = node.parent().value[0][2];
            if (fn === 'sin') {
                node.wrap('Math.PI / 2');
            }
            else if (fn === 'tan') {
                node.wrap('Math.PI / 4');
            }
            else assert.fail('Unknown fn');
        }
    });
    
    assert.equal(res, Math.tan(Math.PI / 4) - Math.sin(Math.PI / 2)); // ~ 0
};

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/parent.js