tap.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. {
  19. begin: '^TAP version (\\d+)$'
  20. },
  21. {
  22. begin: '^1\\.\\.(\\d+)$'
  23. }
  24. ]
  25. },
  26. // YAML block
  27. {
  28. begin: /---$/,
  29. end: '\\.\\.\\.$',
  30. subLanguage: 'yaml',
  31. relevance: 0
  32. },
  33. // testcase number
  34. {
  35. className: 'number',
  36. begin: ' (\\d+) '
  37. },
  38. // testcase status and description
  39. {
  40. className: 'symbol',
  41. variants: [
  42. {
  43. begin: '^ok'
  44. },
  45. {
  46. begin: '^not ok'
  47. }
  48. ]
  49. }
  50. ]
  51. };
  52. }
  53. module.exports = tap;