| Server IP : 74.208.250.37 / Your IP : 216.73.216.114 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ubuntu 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : miferval ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/share/node_modules/libtap/lib/ |
Upload File : |
'use strict'
const diags = require('./diags.js')
const esc = require('./esc.js')
class TestPoint {
constructor (ok, message, extra) {
if (typeof ok !== 'boolean')
throw new TypeError('ok must be boolean')
if (typeof message !== 'string')
throw new TypeError('message must be a string')
extra = extra || {}
message = message.trim().replace(/[\n\r]/g, ' ').replace(/\t/g, ' ')
this.res = { ok, message, extra }
this.extra = extra
this.ok = ok ? 'ok ' : 'not ok '
this.name = message
this.message = tpMessage(esc(this.name), extra)
}
}
const tpMessage = (description, extra) => {
let message = description ? ` - ${description}` : ''
if (extra.skip) {
message += ' # SKIP'
if (typeof extra.skip === 'string')
message += ' ' + esc(extra.skip)
} else if (extra.todo) {
message += ' # TODO'
if (typeof extra.todo === 'string')
message += ' ' + esc(extra.todo)
} else if (extra.time)
message += ' # time=' + extra.time + 'ms'
const diagYaml = extra.diagnostic ? diags(extra) : ''
message += diagYaml + '\n'
return message
}
module.exports = TestPoint