Skip to content

Commit 5f89509

Browse files
committed
update test/too_many.js to use concat-stream instead of tap.createConsumer (method unavailable in tap v7) see: #312 (comment)
1 parent db3a45e commit 5f89509

File tree

1 file changed

+30
-33
lines changed

1 file changed

+30
-33
lines changed

test/too_many.js

+30-33
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,59 @@
11
var falafel = require('falafel');
22
var tape = require('../');
33
var tap = require('tap');
4-
var trim = require('string.prototype.trim');
4+
var concat = require('concat-stream');
55

66
tap.test('array test', function (tt) {
77
tt.plan(1);
8-
8+
99
var test = tape.createHarness({ exit : false });
10-
var tc = tap.createConsumer();
11-
12-
var rows = [];
13-
tc.on('data', function (r) { rows.push(r) });
14-
tc.on('end', function () {
15-
var rs = rows.map(function (r) {
16-
if (r && typeof r === 'object') {
17-
return { id : r.id, ok : r.ok, name : trim(r.name) };
18-
}
19-
else return r;
20-
});
21-
tt.same(rs, [
10+
var tc = function (rows) {
11+
tt.same(rows.toString('utf8'), [
2212
'TAP version 13',
23-
'array',
24-
{ id: 1, ok: true, name: 'should be equivalent' },
25-
{ id: 2, ok: true, name: 'should be equivalent' },
26-
{ id: 3, ok: true, name: 'should be equivalent' },
27-
{ id: 4, ok: true, name: 'should be equivalent' },
28-
{ id: 5, ok: false, name: 'plan != count' },
29-
{ id: 6, ok: true, name: 'should be equivalent' },
30-
'tests 6',
31-
'pass 5',
32-
'fail 1'
33-
]);
34-
});
35-
36-
test.createStream().pipe(tc);
37-
13+
'# array',
14+
'ok 1 should be equivalent',
15+
'ok 2 should be equivalent',
16+
'ok 3 should be equivalent',
17+
'ok 4 should be equivalent',
18+
'not ok 5 plan != count',
19+
' ---',
20+
' operator: fail',
21+
' expected: 3',
22+
' actual: 4',
23+
' ...',
24+
'ok 6 should be equivalent',
25+
'',
26+
'1..6',
27+
'# tests 6',
28+
'# pass 5',
29+
'# fail 1'
30+
].join('\n') + '\n');
31+
};
32+
33+
test.createStream().pipe(concat(tc));
34+
3835
test('array', function (t) {
3936
t.plan(3);
40-
37+
4138
var src = '(' + function () {
4239
var xs = [ 1, 2, [ 3, 4 ] ];
4340
var ys = [ 5, 6 ];
4441
g([ xs, ys ]);
4542
} + ')()';
46-
43+
4744
var output = falafel(src, function (node) {
4845
if (node.type === 'ArrayExpression') {
4946
node.update('fn(' + node.source() + ')');
5047
}
5148
});
52-
49+
5350
var arrays = [
5451
[ 3, 4 ],
5552
[ 1, 2, [ 3, 4 ] ],
5653
[ 5, 6 ],
5754
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ],
5855
];
59-
56+
6057
Function(['fn','g'], output)(
6158
function (xs) {
6259
t.same(arrays.shift(), xs);

0 commit comments

Comments
 (0)