This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove the "hack" that removes SVt_UTF8 in the UTF16 filter, by fixing t/TEST
[perl5.git] / t / io / say.t
1 #!./perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     @INC = '../lib';
6 }
7
8 # Just a few very basic tests cribbed from t/io/print.t,
9 # with some minor additions. say is actually compiled to
10 # a print opcode, so it's more or less guaranteed to behave
11 # the same way as print in any case.
12
13 use strict 'vars';
14 eval 'use Errno';
15 die $@ if $@ and !$ENV{PERL_CORE_MINITEST};
16
17 use feature "say";
18
19 say "1..12";
20
21 my $foo = 'STDOUT';
22 say $foo "ok 1";
23
24 say "ok 2\n","ok 3\n","ok 4";
25 say STDOUT "ok 5";
26
27 open(FOO,">-");
28 say FOO "ok 6";
29
30 open(my $bar,">-");
31 say $bar "ok 7";
32
33 say {"STDOUT"} "ok 8";
34
35 if (!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";
46 say;
47
48 $_ = "ok 11";
49 say 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 }