This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Get t/uni/cache.t working under minitest
[perl5.git] / t / op / filetest_t.t
CommitLineData
827da6a3
JD
1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6 require './test.pl';
7}
8
9use strict;
10
8db8f6b6 11plan 7;
827da6a3
JD
12
13my($dev_tty, $dev_null) = qw(/dev/tty /dev/null);
14 ($dev_tty, $dev_null) = qw(con nul ) if $^O =~ /^(MSWin32|os2)$/;
15 ($dev_tty, $dev_null) = qw(TT: _NLA0: ) if $^O eq "VMS";
16
17SKIP: {
18 open(my $tty, "<", $dev_tty)
c0c40be1 19 or skip("Can't open terminal '$dev_tty': $!", 4);
2dba5d60
CB
20 if ($^O eq 'VMS') {
21 # TT might be a mailbox or other non-terminal device
22 my $tt_dev = VMS::Filespec::vmspath('TT');
c0c40be1 23 skip("'$tt_dev' is probably not a terminal", 4) if $tt_dev !~ m/^_(tt|ft|rt)/i;
2dba5d60
CB
24 }
25 ok(-t $tty, "'$dev_tty' is a TTY");
8db8f6b6
FC
26 ok(-t -e $tty, "'$dev_tty' is a TTY (with -t -e)");
27 -e 'mehyparchonarcheion'; # clear last stat buffer
28 ok(-e -t $tty, "'$dev_tty' is a TTY (with -e -t)");
29 -e 'mehyparchonarcheion';
30 ok(-e -t -t $tty, "'$dev_tty' is a TTY (with -e -t -t)");
827da6a3
JD
31}
32SKIP: {
33 open(my $null, "<", $dev_null)
c0c40be1 34 or skip("Can't open null device '$dev_null': $!", 3);
2dba5d60 35 ok(!-t $null, "'$dev_null' is not a TTY");
8db8f6b6
FC
36 ok(!-t -e $null, "'$dev_null' is not a TTY (with -t -e)");
37 ok(!-e -t $null, "'$dev_null' is not a TTY (with -e -t)");
827da6a3 38}