r68147 - in /branches/upstream/libtest-longstring-perl/current: Changes META.yml README lib/Test/LongString.pm t/01teststring.t t/02import.t t/05lacks.t
angelabad-guest at users.alioth.debian.org
angelabad-guest at users.alioth.debian.org
Tue Feb 8 08:14:32 UTC 2011
Author: angelabad-guest
Date: Tue Feb 8 08:14:17 2011
New Revision: 68147
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=68147
Log:
[svn-upgrade] new version libtest-longstring-perl (0.15)
Modified:
branches/upstream/libtest-longstring-perl/current/Changes
branches/upstream/libtest-longstring-perl/current/META.yml
branches/upstream/libtest-longstring-perl/current/README
branches/upstream/libtest-longstring-perl/current/lib/Test/LongString.pm
branches/upstream/libtest-longstring-perl/current/t/01teststring.t
branches/upstream/libtest-longstring-perl/current/t/02import.t
branches/upstream/libtest-longstring-perl/current/t/05lacks.t
Modified: branches/upstream/libtest-longstring-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-longstring-perl/current/Changes?rev=68147&op=diff
==============================================================================
--- branches/upstream/libtest-longstring-perl/current/Changes (original)
+++ branches/upstream/libtest-longstring-perl/current/Changes Tue Feb 8 08:14:17 2011
@@ -21,3 +21,6 @@
0.14
Compatibility fix with perl 5.13.5
+
+0.15
+ Show line and column number in diagostics (Mark Fowler)
Modified: branches/upstream/libtest-longstring-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-longstring-perl/current/META.yml?rev=68147&op=diff
==============================================================================
--- branches/upstream/libtest-longstring-perl/current/META.yml (original)
+++ branches/upstream/libtest-longstring-perl/current/META.yml Tue Feb 8 08:14:17 2011
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Test-LongString
-version: 0.14
+version: 0.15
abstract: ~
author:
- Rafael Garcia-Suarez <rgs at consttype.org>
@@ -17,7 +17,7 @@
directory:
- t
- inc
-generated_by: ExtUtils::MakeMaker version 6.56
+generated_by: ExtUtils::MakeMaker version 6.55_02
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
Modified: branches/upstream/libtest-longstring-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-longstring-perl/current/README?rev=68147&op=diff
==============================================================================
--- branches/upstream/libtest-longstring-perl/current/README (original)
+++ branches/upstream/libtest-longstring-perl/current/README Tue Feb 8 08:14:17 2011
@@ -1,4 +1,4 @@
-Test::LongString v0.14
+Test::LongString v0.15
======================
A library to test long strings.
@@ -22,4 +22,4 @@
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
-Copyright (c) 2002 - 2010 Rafael Garcia-Suarez
+Copyright (c) 2002 - 2011 Rafael Garcia-Suarez
Modified: branches/upstream/libtest-longstring-perl/current/lib/Test/LongString.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-longstring-perl/current/lib/Test/LongString.pm?rev=68147&op=diff
==============================================================================
--- branches/upstream/libtest-longstring-perl/current/lib/Test/LongString.pm (original)
+++ branches/upstream/libtest-longstring-perl/current/lib/Test/LongString.pm Tue Feb 8 08:14:17 2011
@@ -1,9 +1,9 @@
package Test::LongString;
use strict;
-use vars qw($VERSION @ISA @EXPORT $Max $Context $LCSS);
-
-$VERSION = '0.14';
+use vars qw($VERSION @ISA @EXPORT $Max $Context $EOL $LCSS);
+
+$VERSION = '0.15';
use Test::Builder;
my $Tester = new Test::Builder();
@@ -22,10 +22,14 @@
# Boolean: should we show LCSS context ?
$LCSS = 1;
+# Regular expression that decides what a end of line is
+$EOL = "\n";
+
sub import {
(undef, my %args) = @_;
$Max = $args{max} if defined $args{max};
$LCSS = $args{lcss} if defined $args{lcss};
+ $EOL = $args{eol} if defined $args{eol};
@_ = $_[0];
goto &Exporter::import;
}
@@ -161,10 +165,13 @@
$Tester->ok($ok, $name);
if (!$ok) {
my ($g, $e) = (_display($str), _display($sub));
+ my $line = () = substr($str,0,$index-1) =~ /$EOL/g;
+ my $column = $line ? $index - $+[0] + 1: $index + 1;
+ $line++;
$Tester->diag(<<DIAG);
searched: $g
and found: $e
- at position: $index
+ at position: $index (line $line column $column)
DIAG
}
}
@@ -196,12 +203,15 @@
_display($got, $common_prefix),
_display($expected, $common_prefix),
);
+ my $line = () = substr($expected,0,$common_prefix) =~ /$EOL/g;
+ my $column = $line ? $common_prefix - $+[0] + 1 : $common_prefix + 1;
+ $line++;
$Tester->diag(<<DIAG);
got: $g
length: ${\(length $got)}
expected: $e
length: ${\(length $expected)}
- strings begin to differ at char ${\($common_prefix + 1)}
+ strings begin to differ at char ${\($common_prefix + 1)} (line $line column $column)
DIAG
return 0;
}
@@ -333,6 +343,10 @@
=item *
+It reports the line and column the strings started to differ on.
+
+=item *
+
In the diagnostics, non-ASCII characters are escaped as C<\x{xx}>.
=back
@@ -346,7 +360,7 @@
# length: 1490
# expected: "O Romeo, Romeo,\x{0a}wherefore art thou Romeo?\x{0a}Deny thy"...
# length: 154
- # strings begin to differ at char 1
+ # strings begin to differ at char 1 (line 1 column 1)
=head2 is_string_nows( $string, $expected [, $label ] )
@@ -409,7 +423,7 @@
# Failed test (soliloquy.t at line 10)
# searched: "To be, or not to be: that is the question:\x{0a}Whether"...
# and found: "slings"
- # at position: 147
+ # at position: 147 (line 3 column 4)
=head1 CONTROLLING OUTPUT
@@ -428,6 +442,16 @@
Test::LongString to always print the beginning of compared strings no matter
where they differ, undefine C<$Test::LongString::Context>.
+When computing line numbers this module uses "\n" to count line endings. This
+may not be appropriate for strings on your platform, and can be overriden
+by setting the C<$Test::LongString::EOL> variable to a suitable regular
+expression (either a reference to a regular expression or a string that
+can be interpolated into a regular expression.)
+
+You can also set it by specifying an argument to C<use>:
+
+ use Test::LongString eol => "\x{0a}\x{0c}";
+
=head1 AUTHOR
Written by Rafael Garcia-Suarez. Thanks to Mark Fowler (and to Joss Whedon) for
Modified: branches/upstream/libtest-longstring-perl/current/t/01teststring.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-longstring-perl/current/t/01teststring.t?rev=68147&op=diff
==============================================================================
--- branches/upstream/libtest-longstring-perl/current/t/01teststring.t (original)
+++ branches/upstream/libtest-longstring-perl/current/t/01teststring.t Tue Feb 8 08:14:17 2011
@@ -14,35 +14,35 @@
test_out("not ok 1 - foo is foo");
test_fail(6);
-test_diag(qq( got: "bar"
+test_diag(qq! got: "bar"
# length: 3
# expected: "foo"
# length: 3
-# strings begin to differ at char 1));
+# strings begin to differ at char 1 (line 1 column 1)!);
is_string("bar", "foo", "foo is foo");
test_test("two small strings different");
test_out("not ok 1 - foo is foo");
test_fail(3);
-test_diag(qq( got: undef
-# expected: "foo"));
+test_diag(qq! got: undef
+# expected: "foo"!);
is_string(undef, "foo", "foo is foo");
test_test("got undef, expected small string");
test_out("not ok 1 - foo is foo");
test_fail(3);
-test_diag(qq( got: "foo"
-# expected: undef));
+test_diag(qq! got: "foo"
+# expected: undef!);
is_string("foo", undef, "foo is foo");
test_test("expected undef, got small string");
test_out("not ok 1 - long binary strings");
test_fail(6);
-test_diag(qq( got: "This is a long string that will be truncated by th"...
+test_diag(qq! got: "This is a long string that will be truncated by th"...
# length: 70
# expected: "\\x{00}\\x{01}foo\\x{0a}bar"
# length: 9
-# strings begin to differ at char 1));
+# strings begin to differ at char 1 (line 1 column 1)!);
is_string(
"This is a long string that will be truncated by the display() function",
"\0\1foo\nbar",
@@ -52,11 +52,11 @@
test_out("not ok 1 - spelling");
test_fail(6);
-test_diag(qq( got: "Element"
+test_diag(qq! got: "Element"
# length: 7
# expected: "El\\x{e9}ment"
# length: 7
-# strings begin to differ at char 3));
+# strings begin to differ at char 3 (line 1 column 3)!);
is_string(
"Element",
"Elément",
@@ -66,21 +66,21 @@
test_out('not ok 1 - foo\nfoo is foo\nfoo');
test_fail(6);
-test_diag(qq( got: "foo\\x{0a}foo"
+test_diag(qq! got: "foo\\x{0a}foo"
# length: 7
# expected: "foo\\x{0a}fpo"
# length: 7
-# strings begin to differ at char 6));
+# strings begin to differ at char 6 (line 2 column 2)!);
is_string("foo\nfoo", "foo\nfpo", 'foo\nfoo is foo\nfoo');
test_test("Count correctly prefix with multiline strings");
test_out("not ok 1 - this isn't Ulysses");
test_fail(6);
-test_diag(qq( got: ..."he bowl aloft and intoned:\\x{0a}--Introibo ad altare de"...
+test_diag(qq! got: ..."he bowl aloft and intoned:\\x{0a}--Introibo ad altare de"...
# length: 275
# expected: ..."he bowl alift and intoned:\\x{0a}--Introibo ad altare de"...
# length: 275
-# strings begin to differ at char 233));
+# strings begin to differ at char 233 (line 4 column 17)!);
is_string(
<<ULYS1,
Stately, plump Buck Mulligan came from the stairhead, bearing a bowl of
Modified: branches/upstream/libtest-longstring-perl/current/t/02import.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-longstring-perl/current/t/02import.t?rev=68147&op=diff
==============================================================================
--- branches/upstream/libtest-longstring-perl/current/t/02import.t (original)
+++ branches/upstream/libtest-longstring-perl/current/t/02import.t Tue Feb 8 08:14:17 2011
@@ -9,11 +9,11 @@
test_out("not ok 1 - foobar is foobar");
test_fail(6);
-test_diag(qq( got: "foobu"...
+test_diag(qq! got: "foobu"...
# length: 6
# expected: "fooba"...
# length: 6
-# strings begin to differ at char 5));
+# strings begin to differ at char 5 (line 1 column 5)!);
is_string("foobur", "foobar", "foobar is foobar");
test_test("5 chars in output");
Modified: branches/upstream/libtest-longstring-perl/current/t/05lacks.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-longstring-perl/current/t/05lacks.t?rev=68147&op=diff
==============================================================================
--- branches/upstream/libtest-longstring-perl/current/t/05lacks.t (original)
+++ branches/upstream/libtest-longstring-perl/current/t/05lacks.t Tue Feb 8 08:14:17 2011
@@ -2,7 +2,7 @@
use strict;
-use Test::More tests => 4;
+use Test::More tests => 5;
use Test::Builder::Tester;
use Test::Builder::Tester::Color;
use Test::LongString;
@@ -17,9 +17,24 @@
test_fail(4);
test_diag(qq( searched: "Reese's Peanut Butter Cups"));
test_diag(qq( and found: "Peanut Butter"));
-test_diag(qq( at position: 8));
+test_diag(qq! at position: 8 (line 1 column 9)!);
lacks_string("Reese's Peanut Butter Cups", "Peanut Butter", "Any peanut butter in my chocolate?");
test_test("Not lacking");
+
+# Multiple lines
+test_out("not ok 1 - Mild?");
+test_fail(4);
+test_diag(qq( searched: "Stately, plump Buck Mulligan came from the stairhe"...));
+test_diag(qq( and found: "mild"));
+test_diag(qq! at position: 195 (line 3 column 51)!);
+lacks_string(<<'EXAMPLE',"mild","Mild?");
+Stately, plump Buck Mulligan came from the stairhead, bearing a bowl of
+lather on which a mirror and a razor lay crossed. A yellow dressinggown,
+ungirdled, was sustained gently behind him by the mild morning air. He
+held the bowl aloft and intoned:
+--Introibo ad altare dei.
+EXAMPLE
+test_test("Multiple lines not lacking");
# Source string undef
test_out("not ok 1 - Look inside undef");
More information about the Pkg-perl-cvs-commits
mailing list