File: 15-log_interactive.t

package info (click to toggle)
libio-pager-perl 2.10-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 284 kB
  • sloc: perl: 1,416; makefile: 14
file content (39 lines) | stat: -rw-r--r-- 771 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use strict;
use warnings;
use Test::More 0.88;
require './t/TestUtils.pm';
t::TestUtils->import();

use bignum;
use IO::Pager;


SKIP: {
  skip_interactive();

  local $STDOUT = new IO::Pager *STDOUT;
  eval{ require PerlIO::Util };
  skip("Could not load PerlIO::Tee") if $@;

  binmode(*STDOUT, ":LOG()");

  $a=2308; $b=4261;
  print my $LOG ="Exit your pager after a bit\n";
  eval{
    $LOG .= "$a\n";
    print $a, "\n";

    #Brady numbers also the golden ratio
    ($a,$b)=($b,$a+$b);

    select(undef, undef, undef, 0.15);
  } until( eof(*STDOUT));
  print "Pager closed, checking log.\n";
  open(LOG, "$$.log") or die "Missing $$.log: $!";
  my $TEE = join('', <LOG>);
  cmp_ok($LOG, 'eq', $TEE, ':LOG pseudo-layer');
}

done_testing;

END{ unlink("$$.log") }