Permalink
Browse files

added tests for print and say

  • Loading branch information...
1 parent f20f3ba commit 7cc859c19ca944d6144e7daf3f690836ae35f124 @brunoV brunoV committed Mar 6, 2010
Showing with 45 additions and 0 deletions.
  1. +23 −0 t/print.t
  2. +22 −0 t/say.t
View
23 t/print.t
@@ -0,0 +1,23 @@
+use Test::More qw(no_plan);
+use Test::Output;
+use strict;
+use warnings;
+
+use autobox::Core;
+
+my $message = "This is an important message";
+my @array = qw(this is an important message);
+
+SKIP: {
+ my $has_test_output = eval { require Test::Output };
+
+ skip "Don't have Test::Output", 2, if not $has_test_output;
+ Test::Output::stdout_is( sub { $message->print }, $message );
+ Test::Output::stdout_is( sub { @array->print }, "@array" );
+}
+
+# We need at least one test so that Test::Harness doesn't complain in
+# case we had to skip above
+
+ok 1;
+
View
22 t/say.t
@@ -0,0 +1,22 @@
+use Test::More qw(no_plan);
+use strict;
+use warnings;
+
+use autobox::Core;
+
+my $message = "This is an important message";
+my @array = qw(this is an important message);
+
+SKIP: {
+ my $has_test_output = eval { require Test::Output };
+
+ skip "Don't have Test::Output", 1, if not $has_test_output;
+ Test::Output::stdout_is( sub { $message->say }, $message . "\n" );
+ Test::Output::stdout_is( sub { @array->say }, "@array\n" );
+}
+
+# We need at least one test so that Test::Harness doesn't complain in
+# case we had to skip above
+
+ok 1;
+

0 comments on commit 7cc859c

Please sign in to comment.