PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/syntaxhighlighter_3.0.83/tests/commonjs_tests.js

#
JavaScript | 52 lines | 43 code | 6 blank | 3 comment | 2 complexity | 9e8e4927932c36b73ddc6d568bfc38d8 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
  1. /**
  2. * This is a CommonJS compatibility test. You can run this file with node.
  3. */
  4. require.paths.unshift(__dirname + '/../scripts');
  5. var sys = require('sys'),
  6. shSyntaxHighlighter = require('shCore').SyntaxHighlighter,
  7. code = 'test',
  8. brushes = [
  9. 'AS3',
  10. 'AppleScript',
  11. 'Bash',
  12. 'CSharp',
  13. 'ColdFusion',
  14. 'Cpp',
  15. 'Css',
  16. 'Delphi',
  17. 'Diff',
  18. 'Erlang',
  19. 'Groovy',
  20. 'JScript',
  21. 'Java',
  22. 'JavaFX',
  23. 'Perl',
  24. 'Php',
  25. 'Plain',
  26. 'PowerShell',
  27. 'Python',
  28. 'Ruby',
  29. 'Sass',
  30. 'Scala',
  31. 'Sql',
  32. 'Vb',
  33. 'Xml'
  34. ]
  35. ;
  36. brushes.sort();
  37. for (var i = 0; i < brushes.length; i++)
  38. {
  39. var name = brushes[i],
  40. brush = require('shBrush' + name).Brush
  41. ;
  42. brush = new brush();
  43. brush.init({ toolbar: false });
  44. var result = brush.getHtml(code);
  45. sys.puts(name + (result != null ? ': ok' : ': NOT OK'));
  46. }