Test::More::Unlike - show the matched position
use Test::More tests => 1; use Test::More::Unlike; unlike 'abcdef', qr/cd/; # not ok 1 # # Failed test at t/01_basic.t line 6. # # 'abcdef' # # matches '(?-xism:cd)' # # matched at line: 1, offset: 3 # # Looks like you failed 1 test of 1.
When unlike test fails, if you have used Test::More::Unlike, then the error diag shows additionally the matched position like below.
unlike
# matched at line: 1, offset: 3
NOTE that it is only first matched position. And offset count is calculated as octet.
NOTE that below code does NOT work as expected(It works, but Not show a count of line and offset).
use Test::More::Unlike; use Test::More; unlike 'abcdef', qr/cd/; done_testing;
Test::More should be loaded before Test::More::Unlike.
Test::More
Test::More::Unlike
# This is OK. use Test::More; use Test::More::Unlike;
Test::More::Unlike is hosted on github <http://github.com/bayashi/Test-More-Unlike>
Welcome your patches and issues :D
Dai Okabayashi <bayashi@cpan.org>
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
To install Test::More::Unlike, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::More::Unlike
CPAN shell
perl -MCPAN -e shell install Test::More::Unlike
For more information on module installation, please visit the detailed CPAN module installation guide.