Sha256: acc64a46b1b0a1d4f6518ba7512c63be900a99df315c14cc4d34db0b0be5e695

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

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

exports.wrapError = function () {
    try {
        var src = burrito('f() && g()', function (node) {
            if (node.name === 'binary') node.wrap('h(%a, %b')
        });
        assert.fail('should have blown up');
    }
    catch (err) {
        assert.ok(err.message.match(/unexpected/i));
        assert.ok(err instanceof SyntaxError);
        assert.ok(!err.stack.match(/uglify-js/));
        assert.equal(err.line, 0);
        assert.equal(err.col, 10);
        assert.equal(err.pos, 10);
    }
};

exports.nonString = function () {
    assert.throws(function () {
        burrito.parse(new Buffer('[]'));
    });
    
    assert.throws(function () {
        burrito.parse(new String('[]'));
    });
    
    assert.throws(function () {
        burrito.parse();
    });
};

exports.syntaxError = function () {
    try {
        var src = burrito('f() && g())', function (node) {
            if (node.name === 'binary') node.wrap('h(%a, %b)')
        });
        assert.fail('should have blown up');
    }
    catch (err) {
        assert.ok(err.message.match(/unexpected/i));
        assert.ok(err instanceof SyntaxError);
        assert.ok(!err.stack.match(/uglify-js/));
    }
};

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