This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
new perldelta
[perl5.git] / t / base / term.t
CommitLineData
8d063cd8
LW
1#!./perl
2
9d116dd7
JH
3BEGIN {
4 chdir 't' if -d 't';
9d116dd7
JH
5}
6
36477c24 7print "1..7\n";
8d063cd8
LW
8
9# check "" interpretation
10
11$x = "\n";
2704b27c 12# 10 is ASCII/Iso Latin, 13 is Mac OS, 21 is EBCDIC.
b25e12d2 13if ($x eq chr(10)) { print "ok 1\n";}
95e8664e 14elsif ($x eq chr(13)) { print "ok 1 # Mac OS\n"; }
b25e12d2 15elsif ($x eq chr(21)) { print "ok 1 # EBCDIC\n"; }
9d116dd7 16else {print "not ok 1\n";}
8d063cd8
LW
17
18# check `` processing
19
ad20d923 20$x = `$^X -le "print 'hi there'"`;
8d063cd8
LW
21if ($x eq "hi there\n") {print "ok 2\n";} else {print "not ok 2\n";}
22
23# check $#array
24
25$x[0] = 'foo';
26$x[1] = 'foo';
27$tmp = $#x;
28print "#3\t:$tmp: == :1:\n";
29if ($#x == '1') {print "ok 3\n";} else {print "not ok 3\n";}
30
31# check numeric literal
32
33$x = 1;
34if ($x == '1') {print "ok 4\n";} else {print "not ok 4\n";}
35
36477c24 36$x = '1E2';
37if (($x | 1) == 101) {print "ok 5\n";} else {print "not ok 5\n";}
38
8d063cd8
LW
39# check <> pseudoliteral
40
7b903762 41open(try, "/dev/null") || open(try,"nla0:") || (die "Can't open /dev/null.");
bc769488 42
afd9f252 43if (<try> eq '') {
36477c24 44 print "ok 6\n";
afd9f252
LW
45}
46else {
36477c24 47 print "not ok 6\n";
afd9f252
LW
48 die "/dev/null IS NOT A CHARACTER SPECIAL FILE!!!!\n" unless -c '/dev/null';
49}
8d063cd8 50
2eb25c99 51open(try, "harness") || (die "Can't open harness.");
36477c24 52if (<try> ne '') {print "ok 7\n";} else {print "not ok 7\n";}