Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Create mechanism to create a TODO test #7

Merged
merged 1 commit into from

2 participants

@MidLifeXis

Added code to Template::Test to allow creation of TODO tests.

Use similar method to 'name' function of test definition.

@MidLifeXis MidLifeXis Create mechanism to create a TODO test
- Add a '\n-- todo: reason --' within a test block to mark it as todo
cb47cf5
@MidLifeXis

I have not included a test for this function - do you know of any good examples to follow on how to test that a test is actually a TODO test?

@abw abw merged commit 5550611 into abw:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 10, 2012
  1. @MidLifeXis

    Create mechanism to create a TODO test

    MidLifeXis authored
    - Add a '\n-- todo: reason --' within a test block to mark it as todo
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 2 deletions.
  1. +13 −2 lib/Template/Test.pm
View
15 lib/Template/Test.pm
@@ -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");
};
}
Something went wrong with that request. Please try again.