[svn:parrot] r49804 - branches/tt532_headerizer_refactor/t/tools/dev/headerizer
jkeenan at svn.parrot.org
jkeenan at svn.parrot.org
Mon Nov 8 03:09:05 UTC 2010
Author: jkeenan
Date: Mon Nov 8 03:09:04 2010
New Revision: 49804
URL: https://trac.parrot.org/parrot/changeset/49804
Log:
Add tests of print_headerizer_warnings().
Modified:
branches/tt532_headerizer_refactor/t/tools/dev/headerizer/01_functions.t
Modified: branches/tt532_headerizer_refactor/t/tools/dev/headerizer/01_functions.t
==============================================================================
--- branches/tt532_headerizer_refactor/t/tools/dev/headerizer/01_functions.t Mon Nov 8 02:56:12 2010 (r49803)
+++ branches/tt532_headerizer_refactor/t/tools/dev/headerizer/01_functions.t Mon Nov 8 03:09:04 2010 (r49804)
@@ -5,12 +5,9 @@
use strict;
use warnings;
-use Test::More qw(no_plan); # tests => 60;
+use Test::More tests => 15;
use Cwd;
-#use File::Basename;
-#use File::Copy;
use File::Temp qw( tempdir );
-use Tie::File;
use lib qw( lib );
use Parrot::Headerizer::Functions qw(
print_headerizer_warnings
@@ -41,6 +38,48 @@
is($lines_read[2], 'world', "Got third line");
}
+my $warnings = {
+ 'file1' => {
+ 'func_alpha' => [
+ 'alpha warning 1',
+ 'alpha warning 2',
+ 'alpha warning 3',
+ ],
+ 'func_beta' => [
+ 'beta warning 1',
+ 'beta warning 2',
+ ],
+ },
+ 'file2' => {
+ 'func_gamma' => [
+ 'gamma warning 1',
+ 'gamma warning 2',
+ 'gamma warning 3',
+ ],
+ },
+};
+
+{
+ my ($stdout, $stderr);
+ capture(
+ sub { print_headerizer_warnings($warnings); },
+ \$stdout,
+ \$stderr,
+ );
+ for my $func( qw| alpha gamma | ) {
+ for (1..3) {
+ like( $stdout, qr/func_alpha: alpha warning $_/s,
+ "Got expected output" );
+ }
+ }
+ for (1..2) {
+ like( $stdout, qr/func_beta: beta warning $_/s,
+ "Got expected output" );
+ }
+ like( $stdout, qr/8 warnings in 3 funcs in 2 C files/,
+ "Got expected summary of headerizer warnings" );
+}
+
pass("Completed all tests in $0");
More information about the parrot-commits
mailing list