diff options
Diffstat (limited to 'test/it_pipe.t')
-rwxr-xr-x | test/it_pipe.t | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/it_pipe.t b/test/it_pipe.t index 734b7fa..72847d1 100755 --- a/test/it_pipe.t +++ b/test/it_pipe.t @@ -9,6 +9,14 @@ is(it::pipe('echo {0}{1}', "f", "oo")->lines(), ["foo"]); is(it::pipe('echo {f}', ['f' => 1, 'f' => 2])->lines(), [2]); is(it::pipe(['foo'])->lines(), ["foo"]); +foreach(it::pipe(['a','b','a']) as $i) $x1 .= $i; +is($x1, "aba"); +foreach(it::pipe(['a','b','a'])->filter(fn($x) => $x == 'a') as $i) $x2 .= $i; +is($x2, "aa"); +foreach(it::pipe(['a','b','a'])->grep('a') as $i) $x3 .= $i; +is($x3, "aa"); + + # csv() is(json_encode((new it_pipe(['data' => ["a\tb", "1\t2"]]))->csv()), '[{"a":"1","b":"2"}]'); is(json_encode((new it_pipe(['data' => ["a;b", "1;2"]]))->csv()), '[{"a":"1","b":"2"}]'); |