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