about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-02-02 22:11:43 -1000
committerEric Wong <e@80x24.org>2021-02-04 01:37:10 +0000
commit85d10e97f7c07855c1bbe9bd89e5ebc1aa10352f (patch)
treecd99a27456927246e91e0e735bc0bee2d50e3d88 /t
parenta848cb1e2229e0b313271dad879f9a101e414316 (diff)
downloadpublic-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.t19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/lei.t b/t/lei.t
index 03bbb078..01eed1da 100644
--- a/t/lei.t
+++ b/t/lei.t
@@ -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");