corrade-nucleus-nucleons – Blame information for rev 2
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
2 | office | 1 | /*global js_beautify: true */ |
2 | /*jshint node:true */ |
||
3 | /*jshint unused:false */ |
||
4 | |||
5 | |||
6 | var fs = require('fs'), |
||
7 | SanityTest = require('./sanitytest'), |
||
8 | Benchmark = require('benchmark'), |
||
9 | Urlencoded = require('../lib/unpackers/urlencode_unpacker'), |
||
10 | js_beautify = require('../index').js_beautify, |
||
11 | css_beautify = require('../index').css_beautify, |
||
12 | html_beautify = require('../index').html_beautify; |
||
13 | |||
14 | function node_beautifier_html_tests() { |
||
15 | console.log('Testing performance...'); |
||
16 | var index_html = fs.readFileSync(__dirname + '/../../index.html', 'utf8'); |
||
17 | var data_attr = fs.readFileSync(__dirname + '/../../test/resources/html-with-base64image.html', 'utf8'); |
||
18 | var options = { |
||
19 | wrap_line_length: 80 |
||
20 | }; |
||
21 | |||
22 | //warm-up |
||
23 | html_beautify(index_html, options); |
||
24 | html_beautify(data_attr, options); |
||
25 | |||
26 | var suite = new Benchmark.Suite(); |
||
27 | |||
28 | suite.add("html-beautify (index.html)", function() { |
||
29 | html_beautify(index_html, options); |
||
30 | }) |
||
31 | .add("html-beautify (base64 image)", function() { |
||
32 | html_beautify(data_attr, options); |
||
33 | }) |
||
34 | // add listeners |
||
35 | .on('cycle', function(event) { |
||
36 | console.log(String(event.target)); |
||
37 | }) |
||
38 | .on('error', function(event) { |
||
39 | return 1; |
||
40 | }) |
||
41 | .on('complete', function(event) {}) |
||
42 | .run(); |
||
43 | return 0; |
||
44 | } |
||
45 | |||
46 | |||
47 | |||
48 | |||
49 | if (require.main === module) { |
||
50 | process.exit(node_beautifier_html_tests()); |
||
51 | } |