This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldiag: Document ‘Can't call mro_isa_changed_in’
[perl5.git] / t / io / say.t
CommitLineData
0d863452
RH
1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
bcf53fae
NC
6 require './test.pl';
7 eval 'use Errno';
8 die $@ if $@ and !is_miniperl();
0d863452
RH
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';
0d863452
RH
17use feature "say";
18
9dcb8368 19say "1..13";
0d863452
RH
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;
cfc4a7da
GA
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}
9dcb8368
FC
56
57{
58 no feature 'say';
59 CORE::say "ok 13 - CORE::say without feature.pm";
60}