Change 30123 by [EMAIL PROTECTED] on 2007/02/05 00:12:25
Enhance t/lib/common.pl to provide conditional TODOs using eval'd code.
Affected files ...
... //depot/perl/t/lib/common.pl#8 edit
Differences ...
==== //depot/perl/t/lib/common.pl#8 (text) ====
Index: perl/t/lib/common.pl
--- perl/t/lib/common.pl#7~29825~ 2007-01-15 05:45:40.000000000 -0800
+++ perl/t/lib/common.pl 2007-02-04 16:12:25.000000000 -0800
@@ -73,7 +73,16 @@
my($prog,$expected) = split(/\nEXPECT(?:\n|$)/, $_, 2);
my ($todo, $todo_reason);
- $todo = $prog =~ s/^#\s*TODO(.*)\n//m and $todo_reason = $1;
+ $todo = $prog =~ s/^#\s*TODO\s*(.*)\n//m and $todo_reason = $1;
+ # If the TODO reason starts ? then it's taken as a code snippet to evaluate
+ # This provides the flexibility to have conditional TODOs
+ if ($todo_reason =~ s/^\?//) {
+ my $temp = eval $todo_reason;
+ if ($@) {
+ die "# In TODO code reason:\n# $todo_reason\n$@";
+ }
+ $todo_reason = $temp;
+ }
if ( $prog =~ /--FILE--/) {
my(@files) = split(/\n--FILE--\s*([^\s\n]*)\s*\n/, $prog) ;
shift @files ;
End of Patch.