Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/local/share/.cache/yarn/v6/npm-tap-spec-5.0.0-integrity/node_modules/tap-spec/test/unit/ drwxr-xr-x | |
| Viewing file: Select action/file-type: var ts = require('../..');
var test = require('tapes');
var format = require('chalk');
var symbols = {
ok: '\u2713',
err: '\u2717'
};
var rs = null;
var actual = null;
var tapSpec = null;
test('unit test', function(t) {
t.beforeEach(function(t) {
rs = require('stream').Readable();
rs._read = function noop() {};
actual = '';
tapSpec = ts();
tapSpec.on('data', function(data) {
actual += data.toString();
});
t.end();
});
t.test('Parsing comment', function(t) {
t.plan(1);
var comment = '# This is a comment\n';
var expected = '\n This is a comment\n\n';
rs.on('end', function() {
t.equal(actual, expected, 'Should format comment correctly.');
});
rs.pipe(tapSpec);
rs.push(comment);
rs.push(null);
});
t.test('Assert ok', function(t) {
t.plan(1);
var assert = 'ok 1 this is an ok assertion\n';
var expected = ' ' + format.green(symbols.ok) + ' ' + format.gray('this is an ok assertion') + '\n';
rs.on('end', function() {
t.equal(actual, expected, 'Should format ok assertion correctly.');
});
rs.pipe(tapSpec);
rs.push(assert);
rs.push(null);
});
t.test('Assert not ok', function(t) {
t.plan(1);
var assert = 'not ok 1 this is a not-ok assertion\n';
var expected = ' ' + format.red(symbols.err) + ' ' + format.gray('this is a not-ok assertion') + '\n';
rs.on('end', function() {
t.equal(actual, expected, 'Should format not-ok assertion correctly.');
});
rs.pipe(tapSpec);
rs.push(assert);
rs.push(null);
});
t.test('Extra', function(t) {
t.plan(1);
var extra = 'something extra that does not match any other regex\n';
var expected = ' ' + format.yellow('something extra that does not match any other regex') + '\n';
rs.on('end', function() {
t.equal(actual, expected, 'Should format extra correctly.');
});
rs.pipe(tapSpec);
rs.push(extra);
rs.push(null);
});
t.end();
});
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0081 ]-- |