-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathshould-annotate-xml.js
More file actions
29 lines (23 loc) · 874 Bytes
/
Copy pathshould-annotate-xml.js
File metadata and controls
29 lines (23 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(function () {
"use strict";
var Highlight = require("../lib/highlight.js")
, assert = require('assert')
, fs = require('fs')
, reHasAnnotations = /\sclass="tag"/
;
function runTest(err) {
assert.ok(!err, err && err.message);
assert.strictEqual(1, Highlight.loadedLanguages.length, 'more than one language is loaded: ' + Highlight.loadedLanguages);
assert.strictEqual('xml', Highlight.loadedLanguages[0], 'xml isn\'t the language');
fs.readFile('./example.html', 'utf8', function (err, text) {
var annotated
;
assert.ok(!err, 'threw error reading example.html');
annotated = Highlight.highlight(text, ' ');
assert.ok(annotated.match(reHasAnnotations));
//console.log(annotated);
console.info('[PASS] source is annotated');
});
}
Highlight.init(runTest, ['xml']);
}());