1850e2753Smillert#!./perl 2850e2753Smillert 3850e2753SmillertBEGIN { 4850e2753Smillert chdir 't' if -d 't'; 5898184e3Ssthen require './test.pl'; 6*5759b3d2Safresh1 set_up_inc('../lib'); 7898184e3Ssthen eval 'use Errno'; 8898184e3Ssthen die $@ if $@ and !is_miniperl(); 9850e2753Smillert} 10850e2753Smillert 11850e2753Smillert# Just a few very basic tests cribbed from t/io/print.t, 12850e2753Smillert# with some minor additions. say is actually compiled to 13850e2753Smillert# a print opcode, so it's more or less guaranteed to behave 14850e2753Smillert# the same way as print in any case. 15850e2753Smillert 16850e2753Smillertuse strict 'vars'; 17850e2753Smillertuse feature "say"; 18850e2753Smillert 19898184e3Ssthensay "1..13"; 20850e2753Smillert 21850e2753Smillertmy $foo = 'STDOUT'; 22850e2753Smillertsay $foo "ok 1"; 23850e2753Smillert 24850e2753Smillertsay "ok 2\n","ok 3\n","ok 4"; 25850e2753Smillertsay STDOUT "ok 5"; 26850e2753Smillert 27850e2753Smillertopen(FOO,">-"); 28850e2753Smillertsay FOO "ok 6"; 29850e2753Smillert 30850e2753Smillertopen(my $bar,">-"); 31850e2753Smillertsay $bar "ok 7"; 32850e2753Smillert 33850e2753Smillertsay {"STDOUT"} "ok 8"; 34850e2753Smillert 35850e2753Smillertif (!exists &Errno::EBADF) { 36850e2753Smillert print "ok 9 # skipped: no EBADF\n"; 37850e2753Smillert} else { 38850e2753Smillert $! = 0; 39850e2753Smillert no warnings 'unopened'; 40850e2753Smillert say NONEXISTENT "foo"; 41850e2753Smillert print "not " if ($! != &Errno::EBADF); 42850e2753Smillert say "ok 9"; 43850e2753Smillert} 44850e2753Smillert 45850e2753Smillert$_ = "ok 10"; 46850e2753Smillertsay; 47850e2753Smillert 48850e2753Smillert$_ = "ok 11"; 49850e2753Smillertsay STDOUT; 50850e2753Smillert 51850e2753Smillert{ 52850e2753Smillert # test that $, doesn't show up before the trailing \n 53850e2753Smillert local $, = "\nnot ok 13"; # how to fool Test::Harness 54850e2753Smillert say "ok 12"; 55850e2753Smillert} 56898184e3Ssthen 57898184e3Ssthen{ 58898184e3Ssthen no feature 'say'; 59898184e3Ssthen CORE::say "ok 13 - CORE::say without feature.pm"; 60898184e3Ssthen} 61