File: Term-ReadKey.t

package info (click to toggle)
libterm-table-perl 0.027-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 224 kB
  • sloc: perl: 510; makefile: 2
file content (45 lines) | stat: -rw-r--r-- 1,104 bytes parent folder | download
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
40
41
42
43
44
45
# HARNESS-NO-PRELOAD
#
BEGIN {
    if (eval { require Test2::Tools::Tiny }) {
        print "# Using Test2::Tools::Tiny\n";
        Test2::Tools::Tiny->import();
    }
    else {
        print "1..0 # SKIP Test2::Tools::Tiny is not installed\n";
        exit(0);
    }

    if (grep { -t $_ } *STDOUT, *STDERR, *STDIN) {
        print "# Found usable IO\n";
    }
    else {
        print "1..0 # SKIP No usable IO handles\n";
        exit(0);
    }

    if (eval { require Term::ReadKey; Term::ReadKey->can('GetTerminalSize') }) {
        print "# Using Term::ReadKey\n";
    }
    else {
        print "1..0 # SKIP Term::ReadKey is not installed, or too old\n";
        exit(0);
    }

    if (eval { require Devel::Hide }) {
        Devel::Hide->import('Term::Size::Any');
    }
    else {
        print "1..0 # SKIP Devel::Hide is not installed\n";
        exit(0);
    }
}

use Term::Table::Util qw/USE_TERM_READKEY USE_TERM_SIZE_ANY term_size/;

ok(USE_TERM_READKEY, "Using Term::ReadKey");
ok(!USE_TERM_SIZE_ANY, "Not using Term::Size::Any");

ok(term_size(), "Got terminal size");

done_testing;