diff options
author | Eric Wong <e@80x24.org> | 2021-02-02 22:11:43 -1000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-02-04 01:37:10 +0000 |
commit | 85d10e97f7c07855c1bbe9bd89e5ebc1aa10352f (patch) | |
tree | cd99a27456927246e91e0e735bc0bee2d50e3d88 /t | |
parent | a848cb1e2229e0b313271dad879f9a101e414316 (diff) | |
download | public-inbox-85d10e97f7c07855c1bbe9bd89e5ebc1aa10352f.tar.gz |
This will be useful on shared machines when a user doesn't want search queries visible to other users looking at the ps(1) output or similar.
Diffstat (limited to 't')
-rw-r--r-- | t/lei.t | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -275,6 +275,25 @@ my $test_external = sub { my $pretty = $json->decode($out); is_deeply($res, $pretty, '--pretty is identical after decode'); + { + open my $fh, '+>', undef or BAIL_OUT $!; + $fh->autoflush(1); + print $fh 's:use' or BAIL_OUT $!; + seek($fh, 0, SEEK_SET) or BAIL_OUT $!; + ok($lei->([qw(q -q --stdin)], undef, { %$opt, 0 => $fh }), + '--stdin on regular file works'); + like($out, qr/use boolean prefix/, '--stdin on regular file'); + } + { + pipe(my ($r, $w)) or BAIL_OUT $!; + print $w 's:use' or BAIL_OUT $!; + close $w or BAIL_OUT $!; + ok($lei->([qw(q -q --stdin)], undef, { %$opt, 0 => $r }), + '--stdin on pipe file works'); + like($out, qr/use boolean prefix/, '--stdin on pipe'); + } + ok(!$lei->(qw(q -q --stdin s:use)), "--stdin and argv don't mix"); + for my $fmt (qw(ldjson ndjson jsonl)) { $lei->('q', '-f', $fmt, 's:use boolean prefix'); is($out, $json->encode($pretty->[0])."\n", "-f $fmt"); |