1#!./perl 2 3BEGIN { 4 chdir 't' if -d 't'; 5 require './test.pl'; 6 set_up_inc('../lib'); 7 eval 'use Errno'; 8 die $@ if $@ and !is_miniperl(); 9} 10 11# Just a few very basic tests cribbed from t/io/print.t, 12# with some minor additions. say is actually compiled to 13# a print opcode, so it's more or less guaranteed to behave 14# the same way as print in any case. 15 16use strict 'vars'; 17use feature "say"; 18 19say "1..13"; 20 21my $foo = 'STDOUT'; 22say $foo "ok 1"; 23 24say "ok 2\n","ok 3\n","ok 4"; 25say STDOUT "ok 5"; 26 27open(FOO,">-"); 28say FOO "ok 6"; 29 30open(my $bar,">-"); 31say $bar "ok 7"; 32 33say {"STDOUT"} "ok 8"; 34 35if (!exists &Errno::EBADF) { 36 print "ok 9 # skipped: no EBADF\n"; 37} else { 38 $! = 0; 39 no warnings 'unopened'; 40 say NONEXISTENT "foo"; 41 print "not " if ($! != &Errno::EBADF); 42 say "ok 9"; 43} 44 45$_ = "ok 10"; 46say; 47 48$_ = "ok 11"; 49say STDOUT; 50 51{ 52 # test that $, doesn't show up before the trailing \n 53 local $, = "\nnot ok 13"; # how to fool Test::Harness 54 say "ok 12"; 55} 56 57{ 58 no feature 'say'; 59 CORE::say "ok 13 - CORE::say without feature.pm"; 60} 61