File: 06-scalar_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 (37 lines) | stat: -rw-r--r-- 729 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
use strict;
use warnings;
use Test::More 0.88;
require './t/TestUtils.pm';
t::TestUtils->import();

# Test unbuffered paging

SKIP: {
  skip_interactive();
  
  require IO::Pager;


  {
    my $BOB;
    local $STDOUT = IO::Pager::open($BOB, 'IO::Pager::Buffered');

    is ref($BOB), 'GLOB', 'Gensym';
    isa_ok $STDOUT, 'IO::Pager::Buffered';
    isa_ok $STDOUT, 'Tie::Handle';

    eval {
      my $i = 0;
      for (1..20) {
        printf($BOB "%06i There is more than one to do it.\n", $_);
      }
      printf $BOB "\nEnd of text, try pressing 'Q' to exit.\n", $_;
    };
    close($BOB);
  }

  my $A = prompt("\nWas the text displayed in a pager? [Yn]");
  ok is_yes($A), 'Buffered scalar filehandle';
}

done_testing;