tap.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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: /---$/,
  25. end: '\\.\\.\\.$',
  26. subLanguage: 'yaml',
  27. relevance: 0
  28. },
  29. // testcase number
  30. {
  31. className: 'number',
  32. begin: ' (\\d+) '
  33. },
  34. // testcase status and description
  35. {
  36. className: 'symbol',
  37. variants: [
  38. { begin: '^ok' },
  39. { begin: '^not ok' }
  40. ]
  41. }
  42. ]
  43. };
  44. }
  45. export { tap as default };