コード例 #1
0
ファイル: index.js プロジェクト: jxcjxcjzx/parse-english
/**
 * Utility to test if a given document is both a valid
 * node, and matches a fixture.
 *
 * @param {string} name - Filename of fixture.
 * @param {string} document - Source to validate.
 * @param {string} method - Method to use.
 */
function describeFixture(t, name, doc, method) {
    var nlcstA = english[method || 'parse'](doc);
    var nlcstB = englishNoPosition[method || 'parse'](doc);
    var fixture = require('./fixture/' + name);

    nlcstTest(nlcstA);
    nlcstTest(nlcstB);

    t.deepEqual(nlcstA, fixture, 'should match w/ position');
    t.deepEqual(nlcstB, clean(fixture), 'should match w/o position');
}
コード例 #2
0
ファイル: index.js プロジェクト: wooorm/parse-latin
// Utility to test if a given document is both a valid node, and matches a
// fixture.
function describeFixture(t, name, doc, method) {
  var nlcstA = latin[method || 'parse'](doc)
  var nlcstB = latinNoPosition[method || 'parse'](doc)
  var fixture = JSON.parse(
    fs.readFileSync(path.join(__dirname, 'fixture', name + '.json'))
  )

  nlcstTest(nlcstA)
  nlcstTest(nlcstB)

  t.deepEqual(nlcstA, fixture, 'should match w/ position')
  t.deepEqual(
    nlcstB,
    removePosition(fixture, true),
    'should match w/o position'
  )
}
コード例 #3
0
ファイル: test.js プロジェクト: CSV007/retext
 t.doesNotThrow(function () {
     nlcstTest(retext().parse('Foo'));
 }, 'should return NLCST');