You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
typesetting/pitfall/pdfkit/node_modules/astw/test/json.js

14 lines
337 B
JavaScript

var astw = require('../');
var test = require('tape');
test('json', function (t) {
t.plan(2);
var numbers = [ 1, 2 ];
var walk = astw('{"a":1,"b":2}');
walk(function (node) {
if (node.type === 'Literal' && typeof node.value === 'number') {
t.equal(node.value, numbers.shift());
}
});
});