NAME
Test::LongString - tests strings for equality
SYNOPSIS
use Test::More tests => 1;
use Test::LongString;
is_string('foobar','foobur');
DESCRIPTION
This module provides some drop-in replacements for the string comparison functions of Test::More, but which are more suitable when you test against long strings.
The function is_string()
basically equivalent to Test::More::is()
, but that gives more verbose diagnostics in case of failure.
It reports only the 50 first characters of the compared strings in the failure message, in case of long strings, so this doesn't clutter the test's output. This threshold value can be changed by setting
$Test::LongString::Max
, or by specifying it as an argument to theuse
directive :use Test::LongString max => 100;
It reports the lengths of the strings that have been compared.
It reports the length of the common prefix of the strings.
In the diagnostics, non-ASCII characters are escaped as
\x{xx}
.
The functions like_string()
and unlike_string()
are replacements for Test::More:like()
and unlike()
, that only print the beginning of the received string in the output. (I've no way to figure out the position where the regexp failed to match, if this has a sense.)
AUTHOR
Written by Rafael Garcia-Suarez. Thanks to Mark Fowler (and to Joss Whedon) for the inspirational Acme::Test::Buffy.
This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.