Sha256: d6bf0555feb3920bd9c93af750ca730701214bf17bcc805232c79e9d0576ceaf
Contents?: true
Size: 692 Bytes
Versions: 11
Compression:
Stored size: 692 Bytes
Contents
var astw = require('../'); var test = require('tape'); var generate = require('escodegen').generate; function unparse (s) { return generate(s, { format: { compact: true } }); } test('parent', function (t) { t.plan(4); var walk = astw('(' + function () { var xs = [ 1, 2, 3 ]; fn(ys); } + ')()'); walk(function (node) { if (node.type === 'ArrayExpression') { t.equal(node.parent.type, 'VariableDeclarator'); t.equal(unparse(node.parent), 'xs=[1,2,3]'); t.equal(node.parent.parent.type, 'VariableDeclaration'); t.equal(unparse(node.parent.parent), 'var xs=[1,2,3];'); } }); });
Version data entries
11 entries across 11 versions & 4 rubygems