File tree Expand file tree Collapse file tree 4 files changed +33
-4
lines changed Expand file tree Collapse file tree 4 files changed +33
-4
lines changed Original file line number Diff line number Diff line change @@ -209,6 +209,7 @@ t/source_tests/source.sh
209209t/source_tests/source.t
210210t/source_tests/source.tap
211211t/source_tests/source_args.sh
212+ t/source_tests/test.tap
212213t/spool.t
213214t/state.t
214215t/state_results.t
Original file line number Diff line number Diff line change @@ -269,6 +269,15 @@ sub detect_source {
269269 keys %handlers
270270 );
271271
272+ # Check for a tie.
273+ if ( @handlers > 1 &&
274+ $handlers {$handlers [0]} == $handlers {$handlers [1]}
275+ ) {
276+ my $filename = $source -> meta-> {file }{basename };
277+ die (" There is a tie between $handlers [0] and $handlers [1].\n " .
278+ " Both voted $handlers {$handlers [0]} on $filename .\n " );
279+ }
280+
272281 # this is really useful for debugging handlers:
273282 if ( $ENV {TAP_HARNESS_SOURCE_FACTORY_VOTES } ) {
274283 warn (
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ BEGIN {
1010use strict;
1111use warnings;
1212
13- use Test::More tests => 42 ;
13+ use Test::More tests => 44 ;
1414
1515use IO::File;
1616use File::Spec;
@@ -124,6 +124,9 @@ my @sources = (
124124 handler => 'TAP::Parser::SourceHandler::Handle',
125125 iterator => 'TAP::Parser::Iterator::Stream',
126126 },
127+ { file => 'test.tap',
128+ tie => 1,
129+ },
127130);
128131
129132for my $test (@sources) {
@@ -141,10 +144,18 @@ for my $test (@sources) {
141144 my $source = TAP::Parser::Source->new->raw( ref($raw) ? $raw : \$raw );
142145 my $iterator = eval { $sf->make_iterator($source) };
143146 my $error = $@;
144- ok( !$error, "$name: no error on make_iterator" );
145- diag($error) if $error;
146147
147- # isa_ok( $iterator, $test->{iterator}, $name );
148+ if( $test->{tie} ) {
149+ like(
150+ $error, qr{^There is a tie.*Both voted .* on $test->{file}}ms,
151+ "$name: votes tied"
152+ )
153+ }
154+ else {
155+ ok( !$error, "$name: no error on make_iterator" );
156+ diag($error) if $error;
157+ }
158+
148159 is( $sf->_last_handler, $test->{handler}, $name );
149160}
150161
Original file line number Diff line number Diff line change 1+ # !/usr/bin/perl
2+
3+ # This looks equally like a TAP file and a Perl executable.
4+
5+ print <<'END_TESTS' ;
6+ 1..1
7+ ok 1 - source.pl
8+ END_TESTS
You can’t perform that action at this time.
0 commit comments