99
1010=head1 NAME
1111
12+ t/lib/common.pl - common routines for tests
1213
1314=head1 SYNOPSIS
1415
16+ # in a test file
17+ use lib qw(t/lib);
18+ require "common.pl";
1519
1620=head1 DESCRIPTION
1721
@@ -21,6 +25,8 @@ =head2 Functions
2125
2226=item * dumper
2327
28+ Dump the data structure in a nicer way.
29+
2430=cut
2531
2632# Stolen from Mojo::Util
@@ -106,11 +112,10 @@ sub run_program_test {
106112
107113 subtest " $label - $program " => sub {
108114 my ( $override_file ) =
109- grep { m / \/ ([0-9]+\. ) \Q $label \E \. t \z / x }
110- glob ( catfile( ' t' , basename($program ), ' *.t' ) );
115+ grep { m / \b ([0-9]+\. ) \Q $label \E \. t \z / ax }
116+ glob ( catfile( ' t' , basename($program ), " *.t" ) );
111117
112118 if ( defined $override_file and -e $override_file ) {
113- diag( " Found $program specific override file" );
114119 eval { use lib qw( .) ; require $override_file }
115120 or fail ( " Could not run override file $override_file : $@ " );
116121 }
@@ -135,7 +140,9 @@ =head2 Pre-defined tests
135140
136141=over
137142
138- =item * compile_test
143+ =item * compile_test( PROGRAM )
144+
145+ Check that PROGRAM exists and compiles.
139146
140147=cut
141148
@@ -151,7 +158,11 @@ sub compile_test {
151158 };
152159 }
153160
154- =item * sanity_test
161+ =item * sanity_test( PROGRAM )
162+
163+ Check that PROGRAM exists and compiles, and stop the test if it doesn't.
164+ At the moment this is essentially C<compiile_test > , but it could have
165+ more later.
155166
156167=cut
157168
0 commit comments