tap.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. Language: Test Anything Protocol
  3. Description: TAP, the Test Anything Protocol, is a simple text-based interface between testing modules in a test harness.
  4. Requires: yaml.js
  5. Author: Sergey Bronnikov <sergeyb@bronevichok.ru>
  6. Website: https://testanything.org
  7. */
  8. function tap(hljs) {
  9. return {
  10. name: 'Test Anything Protocol',
  11. case_insensitive: true,
  12. contains: [
  13. hljs.HASH_COMMENT_MODE,
  14. // version of format and total amount of testcases
  15. {
  16. className: 'meta',
  17. variants: [
  18. { begin: '^TAP version (\\d+)$' },
  19. { begin: '^1\\.\\.(\\d+)$' }
  20. ],
  21. },
  22. // YAML block
  23. {
  24. begin: '(\s+)?---$', end: '\\.\\.\\.$',
  25. subLanguage: 'yaml',
  26. relevance: 0
  27. },
  28. // testcase number
  29. {
  30. className: 'number',
  31. begin: ' (\\d+) '
  32. },
  33. // testcase status and description
  34. {
  35. className: 'symbol',
  36. variants: [
  37. { begin: '^ok' },
  38. { begin: '^not ok' }
  39. ],
  40. },
  41. ]
  42. };
  43. }
  44. module.exports = tap;