2024-01-16 21:26:16 +08:00
|
|
|
/*
|
|
|
|
Language: Test Anything Protocol
|
|
|
|
Description: TAP, the Test Anything Protocol, is a simple text-based interface between testing modules in a test harness.
|
|
|
|
Requires: yaml.js
|
|
|
|
Author: Sergey Bronnikov <sergeyb@bronevichok.ru>
|
|
|
|
Website: https://testanything.org
|
|
|
|
*/
|
|
|
|
|
|
|
|
function tap(hljs) {
|
2023-12-18 13:12:25 +08:00
|
|
|
return {
|
2024-01-16 21:26:16 +08:00
|
|
|
name: 'Test Anything Protocol',
|
2023-12-18 13:12:25 +08:00
|
|
|
case_insensitive: true,
|
|
|
|
contains: [
|
|
|
|
hljs.HASH_COMMENT_MODE,
|
|
|
|
// version of format and total amount of testcases
|
|
|
|
{
|
|
|
|
className: 'meta',
|
|
|
|
variants: [
|
2024-01-16 21:26:16 +08:00
|
|
|
{
|
|
|
|
begin: '^TAP version (\\d+)$'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
begin: '^1\\.\\.(\\d+)$'
|
|
|
|
}
|
|
|
|
]
|
2023-12-18 13:12:25 +08:00
|
|
|
},
|
|
|
|
// YAML block
|
|
|
|
{
|
2024-01-16 21:26:16 +08:00
|
|
|
begin: /---$/,
|
|
|
|
end: '\\.\\.\\.$',
|
2023-12-18 13:12:25 +08:00
|
|
|
subLanguage: 'yaml',
|
|
|
|
relevance: 0
|
|
|
|
},
|
2024-01-16 21:26:16 +08:00
|
|
|
// testcase number
|
2023-12-18 13:12:25 +08:00
|
|
|
{
|
|
|
|
className: 'number',
|
|
|
|
begin: ' (\\d+) '
|
|
|
|
},
|
2024-01-16 21:26:16 +08:00
|
|
|
// testcase status and description
|
2023-12-18 13:12:25 +08:00
|
|
|
{
|
|
|
|
className: 'symbol',
|
|
|
|
variants: [
|
2024-01-16 21:26:16 +08:00
|
|
|
{
|
|
|
|
begin: '^ok'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
begin: '^not ok'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2023-12-18 13:12:25 +08:00
|
|
|
]
|
|
|
|
};
|
2024-01-16 21:26:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = tap;
|