![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/local/lib/node_modules/browserify/node_modules/stream-splicer/test/ |
Upload File : |
var pipeline = require('../'); var through = require('through2'); var test = require('tape'); test('get', function (t) { var a = through.obj(); var b = through.obj(); var c = through.obj(); var pipe = pipeline([ a, b, c ]); t.equal(pipe.get(0), a, '0'); t.equal(pipe.get(1), b, '1'); t.equal(pipe.get(2), c, '2'); t.equal(pipe.get(3), undefined, '3'); t.equal(pipe.get(4), undefined, '4'); t.equal(pipe.get(5), undefined, '5'); t.equal(pipe.get(-1), c, '-1'); t.equal(pipe.get(-1), c, '-1'); t.equal(pipe.get(-2), b, '-2'); t.equal(pipe.get(-3), a, '-3'); t.equal(pipe.get(-4), undefined, '-4'); t.equal(pipe.get(-5), undefined, '-5'); t.end(); }); test('nested get', function (t) { var a = through.obj(); var b = through.obj(); var c = through.obj(); var d = through.obj(); var e = through.obj(); var f = through.obj(); var g = through.obj(); var pipe = pipeline([ a, [ b, c, [ d, [ e ], f ] ], g ]); t.equal(pipe.get(0), a); t.equal(pipe.get(1, -1, 1, 0), e); t.equal(pipe.get(1, 3), undefined); t.equal(pipe.get(4, 3), undefined); t.end(); });