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

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

Thread Previous | Thread Next
From:
Abigail
Date:
September 30, 2003 15:07
Subject:
[PATCH lib/warnings.t] Adding TODO functionality to lib/warnings.
Message ID:
20030930220725.GA6578@abigail.nl
The following patch allows one to add 'TODO' tests to lib/warning
tests. 


Abigail


--- lib/warnings.t.orig	Tue Sep 30 23:10:53 2003
+++ lib/warnings.t	Tue Sep 30 23:51:55 2003
@@ -76,6 +76,7 @@
         $switch =~ s/(-\S*[A-Z]\S*)/"$1"/ if $Is_VMS; # protect uc switches
     }
     my($prog,$expected) = split(/\nEXPECT\n/, $_);
+    my $todo = $prog =~ s/^#\s*TODO\s*\n//m;
     if ( $prog =~ /--FILE--/) {
         my(@files) = split(/\n--FILE--\s*([^\s\n]*)\s*\n/, $prog) ;
 	shift @files ;
@@ -177,12 +178,21 @@
 			 (!$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";
+        my $err_line = "PROG: $switch\n$prog\n" .
+                       "EXPECTED:\n$expected\n" .
+                       "GOT:\n$results\n";
+        if ($todo) {
+            $err_line =~ s/^/# /mg if $todo;
+            print $err_line;  # Harness can't filter it out from STDERR.
+        }
+        else {
+            print STDERR $err_line;
+        }
         print "not ";
     }
-    print "ok " . ++$i . "\n";
+    print "ok " . ++$i;
+    print " # TODO" if $todo;
+    print "\n";
     foreach (@temps)
 	{ unlink $_ if $_ }
     foreach (@temp_path)

Thread Previous | Thread Next


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