Permalink
Browse files

Merge pull request #7 from MidLifeXis/todo_tests

Create mechanism to create a TODO test
  • Loading branch information...
2 parents ead6360 + cb47cf5 commit 555061120e87734d73bfc70e12c512b57edbb0bd @abw committed Jan 25, 2013
Showing with 13 additions and 2 deletions.
  1. +13 −2 lib/Template/Test.pm
View
@@ -276,6 +276,12 @@ sub test_expect {
$name = "template text $count";
}
+ # Configure a test as TODO
+ my $todo = '';
+ if ($input =~ s/^\s*-- todo:? (.*?) --\s*\n//im) {
+ $todo = ( $1 eq '' ) ? 'No reason given' : $1;
+ }
+
# split input by a line like "-- expect --"
($input, $expect) =
split(/^\s*--\s*expect\s*--\s*\n/im, $input);
@@ -348,8 +354,13 @@ sub test_expect {
printf(" input: [%s]\nexpect: [%s]\noutput: [%s]\n",
$copyi, $copye, $copyo);
}
-
- ok($match, $match ? "$name matched expected" : "$name did not match expected");
+
+ my $testprefix = $name;
+ if ( $todo ) {
+ $testprefix = "# TODO $todo - $name";
+ }
+
+ ok($match, $match ? "$testprefix matched expected" : "$testprefix did not match expected");
};
}

0 comments on commit 5550611

Please sign in to comment.