src/Fierce.Mvc/wwwroot/content/easyui/insdep/plugin/highlight-9.9.0/test/markup/index.js

(完整代码) 1KB

'use strict';

let _        = require('lodash');
let bluebird = require('bluebird');
let fs       = bluebird.promisifyAll(require('fs'));
let glob     = require('glob');
let hljs     = require('../../build');
let path     = require('path');
let utility  = require('../utility');

function testLanguage(language) {
  describe(language, function() {
    const filePath  = utility.buildPath('markup', language, '*.expect.txt'),
          filenames = glob.sync(filePath);

    _.each(filenames, function(filename) {
      const testName   = path.basename(filename, '.expect.txt'),
            sourceName = filename.replace(/\.expect/, '');

      it(`should markup ${testName}`, function(done) {
        const sourceFile   = fs.readFileAsync(sourceName, 'utf-8'),
              expectedFile = fs.readFileAsync(filename, 'utf-8');

        bluebird.join(sourceFile, expectedFile, function(source, expected) {
          const actual = hljs.highlight(language, source).value;

          actual.trim().should.equal(expected.trim());
          done();
        });
      });
    });
  });
}

describe('hljs.highlight()', function() {
  let markupPath = utility.buildPath('markup');

  return fs.readdirAsync(markupPath).each(testLanguage);
});

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。