Test2::Plugin::SourceDiag - Output the lines of code that resulted in a failure.
This plugin injects diagnostics messages that include the lines of source that executed to produce the test failure. This is a less magical answer to Damian Conway's Test::Expr module, that has the benefit of working on any Test2 based test.
This test:
use Test2::V0; use Test2::Plugin::SourceDiag; ok(0, "fail"); done_testing;
Produces the output:
not ok 1 - fail Failure source code: # ------------ # 4: ok(0, "fail"); # ------------ # Failed test 'fail' # at test.pl line 4.
The source code repository for Test2-Plugin-SourceDiag can be found at http://github.com/Test-More/Test2-Plugin-SourceDiag/.
Copyright 2017 Chad Granum <exodist@cpan.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/
To install Test2::Plugin::SourceDiag, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test2::Plugin::SourceDiag
CPAN shell
perl -MCPAN -e shell install Test2::Plugin::SourceDiag
For more information on module installation, please visit the detailed CPAN module installation guide.