1*0Sstevel@tonic-gate#!./perl 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gate# $RCSfile: term.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:07 $ 4*0Sstevel@tonic-gate 5*0Sstevel@tonic-gateBEGIN { 6*0Sstevel@tonic-gate chdir 't' if -d 't'; 7*0Sstevel@tonic-gate} 8*0Sstevel@tonic-gate 9*0Sstevel@tonic-gateprint "1..7\n"; 10*0Sstevel@tonic-gate 11*0Sstevel@tonic-gate# check "" interpretation 12*0Sstevel@tonic-gate 13*0Sstevel@tonic-gate$x = "\n"; 14*0Sstevel@tonic-gate# 10 is ASCII/Iso Latin, 13 is Mac OS, 21 is EBCDIC. 15*0Sstevel@tonic-gateif ($x eq chr(10)) { print "ok 1\n";} 16*0Sstevel@tonic-gateelsif ($x eq chr(13)) { print "ok 1 # Mac OS\n"; } 17*0Sstevel@tonic-gateelsif ($x eq chr(21)) { print "ok 1 # EBCDIC\n"; } 18*0Sstevel@tonic-gateelse {print "not ok 1\n";} 19*0Sstevel@tonic-gate 20*0Sstevel@tonic-gate# check `` processing 21*0Sstevel@tonic-gate 22*0Sstevel@tonic-gate$x = `$^X -le "print 'hi there'"`; 23*0Sstevel@tonic-gateif ($x eq "hi there\n") {print "ok 2\n";} else {print "not ok 2\n";} 24*0Sstevel@tonic-gate 25*0Sstevel@tonic-gate# check $#array 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate$x[0] = 'foo'; 28*0Sstevel@tonic-gate$x[1] = 'foo'; 29*0Sstevel@tonic-gate$tmp = $#x; 30*0Sstevel@tonic-gateprint "#3\t:$tmp: == :1:\n"; 31*0Sstevel@tonic-gateif ($#x == '1') {print "ok 3\n";} else {print "not ok 3\n";} 32*0Sstevel@tonic-gate 33*0Sstevel@tonic-gate# check numeric literal 34*0Sstevel@tonic-gate 35*0Sstevel@tonic-gate$x = 1; 36*0Sstevel@tonic-gateif ($x == '1') {print "ok 4\n";} else {print "not ok 4\n";} 37*0Sstevel@tonic-gate 38*0Sstevel@tonic-gate$x = '1E2'; 39*0Sstevel@tonic-gateif (($x | 1) == 101) {print "ok 5\n";} else {print "not ok 5\n";} 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate# check <> pseudoliteral 42*0Sstevel@tonic-gate 43*0Sstevel@tonic-gateif ($^O eq 'MacOS') { 44*0Sstevel@tonic-gate open(try,"Dev:Null") || (die "Can't open /dev/null."); 45*0Sstevel@tonic-gate} else { 46*0Sstevel@tonic-gate open(try, "/dev/null") || open(try,"nla0:") || (die "Can't open /dev/null."); 47*0Sstevel@tonic-gate} 48*0Sstevel@tonic-gate 49*0Sstevel@tonic-gateif (<try> eq '') { 50*0Sstevel@tonic-gate print "ok 6\n"; 51*0Sstevel@tonic-gate} 52*0Sstevel@tonic-gateelse { 53*0Sstevel@tonic-gate print "not ok 6\n"; 54*0Sstevel@tonic-gate die "/dev/null IS NOT A CHARACTER SPECIAL FILE!!!!\n" unless -c '/dev/null'; 55*0Sstevel@tonic-gate} 56*0Sstevel@tonic-gate 57*0Sstevel@tonic-gateopen(try, "harness") || (die "Can't open harness."); 58*0Sstevel@tonic-gateif (<try> ne '') {print "ok 7\n";} else {print "not ok 7\n";} 59