Permalink
Browse files

failing test for detach operator

  • Loading branch information...
1 parent 256ddcd commit e6349d318bdb18bf035c7c8767fe5f6c03208575 @substack committed Nov 18, 2013
Showing with 36 additions and 0 deletions.
  1. +36 −0 test/detach.js
View
@@ -0,0 +1,36 @@
+var test = require('tape');
+var bash = require('../');
+var through = require('through');
+var concat = require('concat-stream');
+
+test('detach', function (t) {
+ t.plan(1);
+
+ var sh = bash({ spawn: run, env: { 'PS1': '$ ' } });
+
+ var s = sh.createStream();
+ s.pipe(concat(function (src) {
+ t.equal(src + '', '$ beep boop!');
+ }));
+ s.write('first & second\n');
+ s.end();
+});
+
+function run (cmd, args) {
+ if (cmd === 'first') {
+ var tr = through();
+ setTimeout(function () {
+ tr.queue('boop!');
+ tr.queue(null);
+ }, 200);
+ return tr;
+ }
+ else if (cmd === 'second') {
+ var tr = through();
+ setTimeout(function () {
+ tr.queue('beep ');
+ tr.queue(null);
+ }, 100);
+ return tr;
+ }
+}

0 comments on commit e6349d3

Please sign in to comment.