develooper Front page | perl.perl5.porters | Postings from October 2003

Re: [PATCH lib/warnings.t] Adding TODO functionality to lib/warnings.

From:
Abigail
Date:
October 1, 2003 05:20
Subject:
Re: [PATCH lib/warnings.t] Adding TODO functionality to lib/warnings.
Message ID:
20031001121943.GA29419@abigail.nl
On Tue, Sep 30, 2003 at 05:51:30PM -0700, schwern@pobox.com wrote:
> On Wed, Oct 01, 2003 at 12:07:26AM +0200, Abigail wrote:
> > The following patch allows one to add 'TODO' tests to lib/warning
> > tests. 
> 
> My development environment is a little screwy at the moment, so I can't
> submit a proper patch, but...

[ Snip ]

Good idea. Here's a redone patch:


*** lib/warnings.t.orig	Wed Oct  1 12:46:20 2003
--- lib/warnings.t	Wed Oct  1 13:51:01 2003
***************
*** 76,81 ****
--- 76,83 ----
          $switch =~ s/(-\S*[A-Z]\S*)/"$1"/ if $Is_VMS; # protect uc switches
      }
      my($prog,$expected) = split(/\nEXPECT\n/, $_);
+     my ($todo, $todo_reason);
+     $todo = $prog =~ s/^#\s*TODO(.*)\n//m and $todo_reason = $1;
      if ( $prog =~ /--FILE--/) {
          my(@files) = split(/\n--FILE--\s*([^\s\n]*)\s*\n/, $prog) ;
  	shift @files ;
***************
*** 177,188 ****
  			 (!$option_regex && $results !~ /^\Q$expected/))) or
  	   (!$prefix && (( $option_regex && $results !~ /^$expected/) ||
  			 (!$option_regex && $results ne $expected)))) {
!         print STDERR "PROG: $switch\n$prog\n";
!         print STDERR "EXPECTED:\n$expected\n";
!         print STDERR "GOT:\n$results\n";
          print "not ";
      }
!     print "ok " . ++$i . "\n";
      foreach (@temps)
  	{ unlink $_ if $_ }
      foreach (@temp_path)
--- 179,199 ----
  			 (!$option_regex && $results !~ /^\Q$expected/))) or
  	   (!$prefix && (( $option_regex && $results !~ /^$expected/) ||
  			 (!$option_regex && $results ne $expected)))) {
!         my $err_line = "PROG: $switch\n$prog\n" .
!                        "EXPECTED:\n$expected\n" .
!                        "GOT:\n$results\n";
!         if ($todo) {
!             $err_line =~ s/^/# /mg;
!             print $err_line;  # Harness can't filter it out from STDERR.
!         }
!         else {
!             print STDERR $err_line;
!         }
          print "not ";
      }
!     print "ok " . ++$i;
!     print " # TODO$todo_reason" if $todo;
!     print "\n";
      foreach (@temps)
  	{ unlink $_ if $_ }
      foreach (@temp_path)



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About