diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-08-26 13:29:49 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-08-26 13:29:49 +0000 |
commit | 6dcddb8726532c0ca8ed36e0327e2ff80954f12c (patch) | |
tree | ab28eccd60d4f775a9745317a81c552ce2b02ef8 /t/lib | |
parent | 45f2a18c3b37907ac3044fb3fe75b6bb198022a5 (diff) | |
download | perl-6dcddb8726532c0ca8ed36e0327e2ff80954f12c.tar.gz |
Move all of Test::Harness's test modules into ext/Test/Harness/t/lib
p4raw-id: //depot/perl@34229
Diffstat (limited to 't/lib')
-rw-r--r-- | t/lib/App/Prove/Plugin/Dummy.pm | 7 | ||||
-rw-r--r-- | t/lib/Dev/Null.pm | 18 | ||||
-rw-r--r-- | t/lib/EmptyParser.pm | 30 | ||||
-rw-r--r-- | t/lib/IO/c55Capture.pm | 120 | ||||
-rw-r--r-- | t/lib/MyCustom.pm | 12 | ||||
-rw-r--r-- | t/lib/MyGrammar.pm | 21 | ||||
-rw-r--r-- | t/lib/MyIterator.pm | 26 | ||||
-rw-r--r-- | t/lib/MyIteratorFactory.pm | 19 | ||||
-rw-r--r-- | t/lib/MyPerlSource.pm | 27 | ||||
-rw-r--r-- | t/lib/MyResult.pm | 21 | ||||
-rw-r--r-- | t/lib/MyResultFactory.pm | 23 | ||||
-rw-r--r-- | t/lib/MySource.pm | 34 | ||||
-rw-r--r-- | t/lib/NoFork.pm | 21 | ||||
-rw-r--r-- | t/lib/TAP/Parser/SubclassTest.pm | 39 |
14 files changed, 0 insertions, 418 deletions
diff --git a/t/lib/App/Prove/Plugin/Dummy.pm b/t/lib/App/Prove/Plugin/Dummy.pm deleted file mode 100644 index 7e285bdc7f..0000000000 --- a/t/lib/App/Prove/Plugin/Dummy.pm +++ /dev/null @@ -1,7 +0,0 @@ -package App::Prove::Plugin::Dummy; - -sub import { - main::test_log_import(@_); -} - -1; diff --git a/t/lib/Dev/Null.pm b/t/lib/Dev/Null.pm deleted file mode 100644 index 09ca5d6627..0000000000 --- a/t/lib/Dev/Null.pm +++ /dev/null @@ -1,18 +0,0 @@ -# For shutting up Test::Harness. -# Has to work on 5.004 which doesn't have Tie::StdHandle. -package Dev::Null; - -sub WRITE { } -sub PRINT { } -sub PRINTF { } - -sub TIEHANDLE { - my $class = shift; - my $fh = do { local *HANDLE; \*HANDLE }; - return bless $fh, $class; -} -sub READ { } -sub READLINE { } -sub GETC { } - -1; diff --git a/t/lib/EmptyParser.pm b/t/lib/EmptyParser.pm deleted file mode 100644 index 2f7ec2428e..0000000000 --- a/t/lib/EmptyParser.pm +++ /dev/null @@ -1,30 +0,0 @@ -package EmptyParser; - -use strict; -use vars qw(@ISA); - -use TAP::Parser (); - -@ISA = qw(TAP::Parser); - -sub _initialize { - shift->_set_defaults; -} - -# this should really be in TAP::Parser itself... -sub _set_defaults { - my $self = shift; - - for my $key ( - qw( source_class perl_source_class grammar_class - iterator_factory_class result_factory_class ) - ) - { - my $default_method = "_default_$key"; - $self->$key( $self->$default_method() ); - } - - return $self; -} - -1; diff --git a/t/lib/IO/c55Capture.pm b/t/lib/IO/c55Capture.pm deleted file mode 100644 index ecbcb49ba7..0000000000 --- a/t/lib/IO/c55Capture.pm +++ /dev/null @@ -1,120 +0,0 @@ -package IO::c55Capture; - -use IO::Handle; - -=head1 Name - -t/lib/IO::c55Capture - a wafer-thin test support package - -=head1 Why!? - -Compatibility with 5.5.3 and no external dependencies. - -=head1 Usage - -Works with a global filehandle: - - # set a spool to write to - tie local *STDOUT, 'IO::c55Capture'; - ... - # clear and retrieve buffer list - my @spooled = tied(*STDOUT)->dump(); - -Or, a lexical (and autocreated) filehandle: - - my $capture = IO::c55Capture->new_handle; - ... - my @output = tied($$capture)->dump; - -Note the '$$' dereference. - -=cut - -# XXX actually returns an IO::Handle :-/ -sub new_handle { - my $class = shift; - my $handle = IO::Handle->new; - tie $$handle, $class; - return ($handle); -} - -sub TIEHANDLE { - return bless [], __PACKAGE__; -} - -sub PRINT { - my $self = shift; - - push @$self, @_; -} - -sub PRINTF { - my $self = shift; - push @$self, sprintf(@_); -} - -sub dump { - my $self = shift; - my @got = @$self; - @$self = (); - return @got; -} - -package util; - -use IO::File; - -# mostly stolen from Module::Build MBTest.pm - -{ # backwards compatible temp filename recipe adapted from perlfaq - my $tmp_count = 0; - my $tmp_base_name = sprintf( "%d-%d", $$, time() ); - - sub temp_file_name { - sprintf( "%s-%04d", $tmp_base_name, ++$tmp_count ); - } -} -######################################################################## - -sub save_handle { - my ( $handle, $subr ) = @_; - my $outfile = temp_file_name(); - - local *SAVEOUT; - open SAVEOUT, ">&" . fileno($handle) - or die "Can't save output handle: $!"; - open $handle, "> $outfile" or die "Can't create $outfile: $!"; - - eval { $subr->() }; - my $err = $@; - open $handle, ">&SAVEOUT" or die "Can't restore output: $!"; - - my $ret = slurp($outfile); - 1 while unlink $outfile; - $err and die $err; - return $ret; -} - -sub stdout_of { save_handle( \*STDOUT, @_ ) } -sub stderr_of { save_handle( \*STDERR, @_ ) } - -sub stdout_stderr_of { - my $subr = shift; - my ( $stdout, $stderr ); - $stdout = stdout_of( - sub { - $stderr = stderr_of($subr); - } - ); - return ( $stdout, $stderr ); -} - -sub slurp { - my $fh = IO::File->new( $_[0] ) or die "Can't open $_[0]: $!"; - local $/; - return scalar <$fh>; -} - -1; - -# vim:ts=4:sw=4:et:sta diff --git a/t/lib/MyCustom.pm b/t/lib/MyCustom.pm deleted file mode 100644 index 2402312edc..0000000000 --- a/t/lib/MyCustom.pm +++ /dev/null @@ -1,12 +0,0 @@ -# avoid cut-n-paste exhaustion with this mixin - -package MyCustom; -use strict; - -sub custom { - my $self = shift; - $main::CUSTOM{ ref($self) }++; - return $self; -} - -1; diff --git a/t/lib/MyGrammar.pm b/t/lib/MyGrammar.pm deleted file mode 100644 index ef93f9dfc1..0000000000 --- a/t/lib/MyGrammar.pm +++ /dev/null @@ -1,21 +0,0 @@ -# subclass for testing customizing & subclassing - -package MyGrammar; - -use strict; -use vars '@ISA'; - -use MyCustom; -use TAP::Parser::Grammar; - -@ISA = qw( TAP::Parser::Grammar MyCustom ); - -sub _initialize { - my $self = shift; - $self->SUPER::_initialize(@_); - $main::INIT{ ref($self) }++; - $self->{initialized} = 1; - return $self; -} - -1; diff --git a/t/lib/MyIterator.pm b/t/lib/MyIterator.pm deleted file mode 100644 index 561f6e2c78..0000000000 --- a/t/lib/MyIterator.pm +++ /dev/null @@ -1,26 +0,0 @@ -# subclass for testing customizing & subclassing - -package MyIterator; - -use strict; -use vars '@ISA'; - -use MyCustom; -use TAP::Parser::Iterator; - -@ISA = qw( TAP::Parser::Iterator MyCustom ); - -sub _initialize { - my $self = shift; - $self->SUPER::_initialize(@_); - $main::INIT{ ref($self) }++; - $self->{initialized} = 1; - $self->{content} = [ 'whats TAP all about then?', '1..1', 'ok 1' ]; - return $self; -} - -sub next { - return shift @{ $_[0]->{content} }; -} - -1; diff --git a/t/lib/MyIteratorFactory.pm b/t/lib/MyIteratorFactory.pm deleted file mode 100644 index d8c3269cda..0000000000 --- a/t/lib/MyIteratorFactory.pm +++ /dev/null @@ -1,19 +0,0 @@ -# subclass for testing customizing & subclassing - -package MyIteratorFactory; - -use strict; -use vars '@ISA'; - -use MyCustom; -use MyIterator; -use TAP::Parser::IteratorFactory; - -@ISA = qw( TAP::Parser::IteratorFactory MyCustom ); - -sub make_iterator { - my $class = shift; - return MyIterator->new(@_); -} - -1; diff --git a/t/lib/MyPerlSource.pm b/t/lib/MyPerlSource.pm deleted file mode 100644 index 6193db97df..0000000000 --- a/t/lib/MyPerlSource.pm +++ /dev/null @@ -1,27 +0,0 @@ -# subclass for testing customizing & subclassing - -package MyPerlSource; - -use strict; -use vars '@ISA'; - -use MyCustom; -use TAP::Parser::Source::Perl; - -@ISA = qw( TAP::Parser::Source::Perl MyCustom ); - -sub _initialize { - my $self = shift; - $self->SUPER::_initialize(@_); - $main::INIT{ ref($self) }++; - $self->{initialized} = 1; - return $self; -} - -sub source { - my $self = shift; - return $self->SUPER::source(@_); -} - -1; - diff --git a/t/lib/MyResult.pm b/t/lib/MyResult.pm deleted file mode 100644 index ab4845dedf..0000000000 --- a/t/lib/MyResult.pm +++ /dev/null @@ -1,21 +0,0 @@ -# subclass for testing customizing & subclassing - -package MyResult; - -use strict; -use vars '@ISA'; - -use MyCustom; -use TAP::Parser::Result; - -@ISA = qw( TAP::Parser::Result MyCustom ); - -sub _initialize { - my $self = shift; - $self->SUPER::_initialize(@_); - $main::INIT{ ref($self) }++; - $self->{initialized} = 1; - return $self; -} - -1; diff --git a/t/lib/MyResultFactory.pm b/t/lib/MyResultFactory.pm deleted file mode 100644 index 371bba632b..0000000000 --- a/t/lib/MyResultFactory.pm +++ /dev/null @@ -1,23 +0,0 @@ -# subclass for testing customizing & subclassing - -package MyResultFactory; - -use strict; -use vars '@ISA'; - -use MyCustom; -use MyResult; -use TAP::Parser::ResultFactory; - -@ISA = qw( TAP::Parser::ResultFactory MyCustom ); - -sub make_result { - my $class = shift; - - # I know, this is not really being initialized, but - # for consistency's sake, deal with it :) - $main::INIT{$class}++; - return MyResult->new(@_); -} - -1; diff --git a/t/lib/MySource.pm b/t/lib/MySource.pm deleted file mode 100644 index 5e41b829ae..0000000000 --- a/t/lib/MySource.pm +++ /dev/null @@ -1,34 +0,0 @@ -# subclass for testing customizing & subclassing - -package MySource; - -use strict; -use vars '@ISA'; - -use MyCustom; -use TAP::Parser::Source; - -@ISA = qw( TAP::Parser::Source MyCustom ); - -sub _initialize { - my $self = shift; - $self->SUPER::_initialize(@_); - $main::INIT{ ref($self) }++; - $self->{initialized} = 1; - return $self; -} - -sub source { - my $self = shift; - return $self->SUPER::source(@_); -} - -sub get_stream { - my $self = shift; - my $stream = $self->SUPER::get_stream(@_); - - # re-bless it: - bless $stream, 'MyIterator'; -} - -1; diff --git a/t/lib/NoFork.pm b/t/lib/NoFork.pm deleted file mode 100644 index 0225e9628d..0000000000 --- a/t/lib/NoFork.pm +++ /dev/null @@ -1,21 +0,0 @@ -package NoFork; - -BEGIN { - *CORE::GLOBAL::fork = sub { die "you should not fork" }; -} -use Config; -tied(%Config)->{d_fork} = 0; # blatant lie - -=begin TEST - -Assuming not to much chdir: - - PERL5OPT='-It/lib -MNoFork' perl -Ilib bin/prove -r t - -=end TEST - -=cut - -1; - -# vim:ts=4:sw=4:et:sta diff --git a/t/lib/TAP/Parser/SubclassTest.pm b/t/lib/TAP/Parser/SubclassTest.pm deleted file mode 100644 index 84becee932..0000000000 --- a/t/lib/TAP/Parser/SubclassTest.pm +++ /dev/null @@ -1,39 +0,0 @@ -# subclass for testing subclassing - -package TAP::Parser::SubclassTest; - -use strict; -use vars qw(@ISA); - -use TAP::Parser; - -use MyCustom; -use MySource; -use MyPerlSource; -use MyGrammar; -use MyIteratorFactory; -use MyResultFactory; - -@ISA = qw( TAP::Parser MyCustom ); - -sub _default_source_class {'MySource'} -sub _default_perl_source_class {'MyPerlSource'} -sub _default_grammar_class {'MyGrammar'} -sub _default_iterator_factory_class {'MyIteratorFactory'} -sub _default_result_factory_class {'MyResultFactory'} - -sub make_source { shift->SUPER::make_source(@_)->custom } -sub make_perl_source { shift->SUPER::make_perl_source(@_)->custom } -sub make_grammar { shift->SUPER::make_grammar(@_)->custom } -sub make_iterator { shift->SUPER::make_iterator(@_)->custom } -sub make_result { shift->SUPER::make_result(@_)->custom } - -sub _initialize { - my $self = shift; - $self->SUPER::_initialize(@_); - $main::INIT{ ref($self) }++; - $self->{initialized} = 1; - return $self; -} - -1; |