From: Uri Guttman Date: Sat, 16 Apr 2011 07:26:14 +0000 (-0400) Subject: deleted X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=urisagit%2FPerl-Docs.git;a=commitdiff_plain;h=cfa512db1acfce24f3bc1f0dba49f3fffd1722da deleted --- diff --git a/t/common.pm b/t/common.pm deleted file mode 100644 index a6fb400..0000000 --- a/t/common.pm +++ /dev/null @@ -1,64 +0,0 @@ -# common.pm - common test driver code - -use Test::More ; - -sub tester { - - my( $tests ) = @_ ; - -use Data::Dumper ; - -# plan for one expected ok() call per test - - plan( tests => scalar @{$tests} ) ; - -# loop over all the tests - - foreach my $test ( @{$tests} ) { - -#print Dumper $test ; - - - if ( $test->{skip} ) { - ok( 1, "SKIPPING $test->{name}" ) ; - next ; - } - -# run any setup sub before this test. this can is used to modify the -# object for this test (e.g. delete templates from the cache). - - if( my $pretest = $test->{pretest} ) { - - $pretest->($test) ; - } - - my $sub = $test->{sub} ; - my $args = $test->{args} ; - - my $result = eval { - $sub->( @{$args} ) ; - } ; - -# if we had an error and expected it, we pass this test - - if ( $@ ) { - - if ( $test->{error} && $@ =~ /$test->{error}/ ) { - - ok( 1, $test->{name} ) ; - } - else { - - print "unexpected error: $@\n" ; - ok( 0, $test->{name} ) ; - } - } - - if( my $posttest = $test->{posttest} ) { - - $posttest->($test) ; - } - } -} - -1 ; diff --git a/t/driver.pm b/t/driver.pm deleted file mode 100644 index ca75377..0000000 --- a/t/driver.pm +++ /dev/null @@ -1,77 +0,0 @@ -# driver.pm - common test driver code - -use Test::More ; - -BEGIN { - *CORE::GLOBAL::syswrite = - sub(*\$$;$) { my( $h, $b, $s ) = @_; CORE::syswrite $h, $b, $s } ; - - *CORE::GLOBAL::sysread = - sub(*\$$;$) { my( $h, $b, $s ) = @_; CORE::sysread $h, $b, $s } ; -} - -sub test_driver { - - my( $tests ) = @_ ; - -use Data::Dumper ; - -# plan for one expected ok() call per test - - plan( tests => scalar @{$tests} ) ; - -# loop over all the tests - - foreach my $test ( @{$tests} ) { - -#print Dumper $test ; - - if ( $test->{skip} ) { - ok( 1, "SKIPPING $test->{name}" ) ; - next ; - } - - my $override = $test->{override} ; - -# run any setup sub before this test. this can is used to modify the -# object for this test (e.g. delete templates from the cache). - - if( my $pretest = $test->{pretest} ) { - - $pretest->($test) ; - } - - my $sub = $test->{sub} ; - my $args = $test->{args} ; - -local( $^W) ; - local *{"CORE::GLOBAL::$override"} = sub {} if $override ; - - my $result = eval { - $sub->( @{$args} ) ; - } ; - -# if we had an error and expected it, we pass this test - - if ( $@ ) { - - if ( $test->{error} && $@ =~ /$test->{error}/ ) { - - ok( 1, $test->{name} ) ; -#print "ERR [$@]\n" ; - } - else { - - print "unexpected error: $@\n" ; - ok( 0, $test->{name} ) ; - } - } - - if( my $posttest = $test->{posttest} ) { - - $posttest->($test) ; - } - } -} - -1 ; diff --git a/t/foo.pl b/t/foo.pl deleted file mode 100644 index bdf59a8..0000000 --- a/t/foo.pl +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/local/bin/perl - - - sub pipe_from_fork ($) { - my $parent = shift; - pipe $parent, my $child or die; - my $pid = fork(); - die "fork() failed: $!" unless defined $pid; - if ($pid) { - close $child; - } - else { - close $parent; - open(STDOUT, ">&=" . fileno($child)) or die; - } - $pid; - } - - if (pipe_from_fork('BAR')) { - # parent - while () { print; } - close BAR; - } - else { - # child - print "pipe_from_fork\n"; - close STDOUT; - exit(0); - } - diff --git a/t/foo2.pl b/t/foo2.pl deleted file mode 100644 index 00b1740..0000000 --- a/t/foo2.pl +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/local/bin/perl - sub pipe_to_fork ($) { - my $parent = shift; - pipe my $child, $parent or die; - my $pid = fork(); - die "fork() failed: $!" unless defined $pid; - if ($pid) { - close $child; - } - else { - close $parent; - open(STDIN, "<&=" . fileno($child)) or die; - } - $pid; - } - - if (pipe_to_fork('FOO')) { - # parent - print FOO "pipe_to_fork\n"; - close FOO; - } - else { - # child - while () { print; } - close STDIN; - exit(0); - } diff --git a/t/over.pl b/t/over.pl deleted file mode 100644 index ce9bafb..0000000 --- a/t/over.pl +++ /dev/null @@ -1,17 +0,0 @@ - -print prototype( 'CORE::sysread' ), "\n" ; - -BEGIN { - - *CORE::GLOBAL::time = sub { CORE::time }; -} - -print time(), "\n" ; - -BEGIN{ -local *CORE::GLOBAL::time = sub { 123 }; - -print time(), "\n" ; -} - -print time(), "\n" ;