diff options
author | JinweiClarkChao <[email protected]> | 2014-08-22 17:23:02 +0800 |
---|---|---|
committer | Jinwei Zhao <[email protected]> | 2017-01-13 15:07:42 +0800 |
commit | 80255411ee7040e0cebbf6b05d2ce323f6f2596e (patch) | |
tree | 295b0ef6c85e7cb091b63719ab041596879690fa /Back/Blocks/syntax/tests/commonjs_tests.js | |
parent | 13be3d058713e1467ffc573a90cc694b80526135 (diff) | |
download | jinwei.me-80255411ee7040e0cebbf6b05d2ce323f6f2596e.tar.gz |
backup
Diffstat (limited to 'Back/Blocks/syntax/tests/commonjs_tests.js')
-rw-r--r-- | Back/Blocks/syntax/tests/commonjs_tests.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Back/Blocks/syntax/tests/commonjs_tests.js b/Back/Blocks/syntax/tests/commonjs_tests.js new file mode 100644 index 0000000..cda8162 --- /dev/null +++ b/Back/Blocks/syntax/tests/commonjs_tests.js | |||
@@ -0,0 +1,52 @@ | |||
1 | /** | ||
2 | * This is a CommonJS compatibility test. You can run this file with node. | ||
3 | */ | ||
4 | require.paths.unshift(__dirname + '/../scripts'); | ||
5 | |||
6 | var sys = require('sys'), | ||
7 | shSyntaxHighlighter = require('shCore').SyntaxHighlighter, | ||
8 | code = 'test', | ||
9 | brushes = [ | ||
10 | 'AS3', | ||
11 | 'AppleScript', | ||
12 | 'Bash', | ||
13 | 'CSharp', | ||
14 | 'ColdFusion', | ||
15 | 'Cpp', | ||
16 | 'Css', | ||
17 | 'Delphi', | ||
18 | 'Diff', | ||
19 | 'Erlang', | ||
20 | 'Groovy', | ||
21 | 'JScript', | ||
22 | 'Java', | ||
23 | 'JavaFX', | ||
24 | 'Perl', | ||
25 | 'Php', | ||
26 | 'Plain', | ||
27 | 'PowerShell', | ||
28 | 'Python', | ||
29 | 'Ruby', | ||
30 | 'Sass', | ||
31 | 'Scala', | ||
32 | 'Sql', | ||
33 | 'Vb', | ||
34 | 'Xml' | ||
35 | ] | ||
36 | ; | ||
37 | |||
38 | brushes.sort(); | ||
39 | |||
40 | for (var i = 0; i < brushes.length; i++) | ||
41 | { | ||
42 | var name = brushes[i], | ||
43 | brush = require('shBrush' + name).Brush | ||
44 | ; | ||
45 | |||
46 | brush = new brush(); | ||
47 | brush.init({ toolbar: false }); | ||
48 | |||
49 | var result = brush.getHtml(code); | ||
50 | |||
51 | sys.puts(name + (result != null ? ': ok' : ': NOT OK')); | ||
52 | } | ||