summaryrefslogtreecommitdiff
path: root/t/io
diff options
context:
space:
mode:
authorRobin Houston <robin@cpan.org>2005-12-17 20:44:31 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-12-19 16:26:15 +0000
commit0d863452f5cac86322a90184dc68dbf446006ed7 (patch)
treea6b225c0f732e2062a2c430a359c1c1db88fa36c /t/io
parent4f5010f268a8de0d9ea78da367041150ef2777f4 (diff)
downloadperl-0d863452f5cac86322a90184dc68dbf446006ed7.tar.gz
latest switch/say/~~
Message-Id: <20051217204431.GB28940@rpc142.cs.man.ac.uk> p4raw-id: //depot/perl@26400
Diffstat (limited to 't/io')
-rw-r--r--t/io/say.t49
1 files changed, 49 insertions, 0 deletions
diff --git a/t/io/say.t b/t/io/say.t
new file mode 100644
index 0000000000..62cec80237
--- /dev/null
+++ b/t/io/say.t
@@ -0,0 +1,49 @@
+#!./perl
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
+# Just a few very basic tests cribbed from t/io/print.t,
+# with some minor additions. say is actually compiled to
+# a print opcode, so it's more or less guaranteed to behave
+# the same way as print in any case.
+
+use strict 'vars';
+eval 'use Errno';
+die $@ if $@ and !$ENV{PERL_CORE_MINITEST};
+
+use feature "say";
+
+say "1..11";
+
+my $foo = 'STDOUT';
+say $foo "ok 1";
+
+say "ok 2\n","ok 3\n","ok 4";
+say STDOUT "ok 5";
+
+open(FOO,">-");
+say FOO "ok 6";
+
+open(my $bar,">-");
+say $bar "ok 7";
+
+say {"STDOUT"} "ok 8";
+
+if (!exists &Errno::EBADF) {
+ print "ok 9 # skipped: no EBADF\n";
+} else {
+ $! = 0;
+ no warnings 'unopened';
+ say NONEXISTENT "foo";
+ print "not " if ($! != &Errno::EBADF);
+ say "ok 9";
+}
+
+$_ = "ok 10";
+say;
+
+$_ = "ok 11";
+say STDOUT;