Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grantstreetgroup/test2-plugin-todofailonsuccess
Report failure if a TODO test unexpectedly passes
https://github.com/grantstreetgroup/test2-plugin-todofailonsuccess
Last synced: about 1 month ago
JSON representation
Report failure if a TODO test unexpectedly passes
- Host: GitHub
- URL: https://github.com/grantstreetgroup/test2-plugin-todofailonsuccess
- Owner: GrantStreetGroup
- License: other
- Created: 2019-08-12T18:42:14.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-26T21:13:52.000Z (over 5 years ago)
- Last Synced: 2023-08-20T22:45:39.127Z (over 1 year ago)
- Language: Perl
- Size: 14.6 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# NAME
Test2::Plugin::TodoFailOnSuccess - Report failure if a TODO test unexpectedly passes
# VERSION
version 0.0.2
# SYNOPSIS
package My::Tests;
use Test2::V0;
use Test2::Plugin::TodoFailOnSuccess; # report unexpected TODO success
use Test2::Tools::Basic; # for "todo" sub
use Test2::Todo; # for "todo" objectsub test_something
{
# Lexical scope TODO:
#
{
my $todo = todo 'Not expected to pass';
is $value, $expected_value, "Got expected value";
}# Coderef TODO:
#
todo 'Not expected to pass either' => sub {
is $value, $expected_value, "Got expected value";
};# Object-oriented TODO:
#
my $todo = Test2::Todo->new( reason => 'Still not expected to pass' );
is $value, $expected_value, "Got expected value";
$todo->end;
}# DESCRIPTION
Wrapping a test with TODO is a conventient way to avoid being tripped
up by test failures until you have a chance to get the code working.
It normally won't hurt to leave the TODO in place after the tests
start passing, but if you forget to remove the TODO at that point,
a subsequent code change could start causing new test failures which
would then go unreported and possibly unnoticed.This module provides a mechanism to trigger explicit test failures
when TODO tests unexpectedly pass, so that you have an opportunity
to remove the TODO.If a TODO test passes, a failure will be reported with a message
containing the test description, equivalent to doing:fail "TODO passed unexpectedly: $test_description";
which might appear in your TAP output along with the TODO reason as
something like:not ok 3 - TODO passed unexpectedly: Got expected value # TODO Not expected to pass
Note that due to the additional `fail` being reported, you may
see messages about your planned number of tests being exceeded,
for example:# Did not follow plan: expected 5, ran 6.
There are no options or arguments, just `use Test2::Plugin::TodoFailOnSuccess`
in your test file.# AUTHOR
Grant Street Group
# COPYRIGHT AND LICENSE
This software is Copyright (c) 2019 by Grant Street Group.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
# CONTRIBUTOR
Larry Leszczynski