r51923 - in /trunk/libtest-longstring-perl: Changes MANIFEST META.yml debian/changelog debian/control debian/copyright lib/Test/LongString.pm t/02import.t t/04contains.t t/06lcss.t
angelabad-guest at users.alioth.debian.org
angelabad-guest at users.alioth.debian.org
Sun Jan 31 13:14:27 UTC 2010
Author: angelabad-guest
Date: Sun Jan 31 13:14:19 2010
New Revision: 51923
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=51923
Log:
New upstream release 0.13
Added:
trunk/libtest-longstring-perl/t/06lcss.t
- copied unchanged from r51920, branches/upstream/libtest-longstring-perl/current/t/06lcss.t
Modified:
trunk/libtest-longstring-perl/Changes
trunk/libtest-longstring-perl/MANIFEST
trunk/libtest-longstring-perl/META.yml
trunk/libtest-longstring-perl/debian/changelog
trunk/libtest-longstring-perl/debian/control
trunk/libtest-longstring-perl/debian/copyright
trunk/libtest-longstring-perl/lib/Test/LongString.pm
trunk/libtest-longstring-perl/t/02import.t
trunk/libtest-longstring-perl/t/04contains.t
Modified: trunk/libtest-longstring-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-longstring-perl/Changes?rev=51923&op=diff
==============================================================================
--- trunk/libtest-longstring-perl/Changes (original)
+++ trunk/libtest-longstring-perl/Changes Sun Jan 31 13:14:19 2010
@@ -15,3 +15,6 @@
0.12
Show longest common substring in diagnostics
(Breno G. de Oliveira)
+
+0.13
+ Allow to display LCSS output in diagnostics
Modified: trunk/libtest-longstring-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-longstring-perl/MANIFEST?rev=51923&op=diff
==============================================================================
--- trunk/libtest-longstring-perl/MANIFEST (original)
+++ trunk/libtest-longstring-perl/MANIFEST Sun Jan 31 13:14:19 2010
@@ -8,6 +8,7 @@
t/03like.t
t/04contains.t
t/05lacks.t
+t/06lcss.t
t/pod.t
t/pod-coverage.t
Changes
Modified: trunk/libtest-longstring-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-longstring-perl/META.yml?rev=51923&op=diff
==============================================================================
--- trunk/libtest-longstring-perl/META.yml (original)
+++ trunk/libtest-longstring-perl/META.yml Sun Jan 31 13:14:19 2010
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Test-LongString
-version: 0.12
+version: 0.13
abstract: ~
license: perl
author:
Modified: trunk/libtest-longstring-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-longstring-perl/debian/changelog?rev=51923&op=diff
==============================================================================
--- trunk/libtest-longstring-perl/debian/changelog (original)
+++ trunk/libtest-longstring-perl/debian/changelog Sun Jan 31 13:14:19 2010
@@ -1,3 +1,12 @@
+libtest-longstring-perl (0.13-1) unstable; urgency=low
+
+ * New upstream release
+ * Update copyright file
+ * Bump Standards-Version to 3.8.4 (no changes)
+ * Add myself to uploaders
+
+ -- Angel Abad <angelabad at gmail.com> Sun, 31 Jan 2010 14:13:53 +0100
+
libtest-longstring-perl (0.12-1) unstable; urgency=low
[ Jonathan Yu ]
Modified: trunk/libtest-longstring-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-longstring-perl/debian/control?rev=51923&op=diff
==============================================================================
--- trunk/libtest-longstring-perl/debian/control (original)
+++ trunk/libtest-longstring-perl/debian/control Sun Jan 31 13:14:19 2010
@@ -2,18 +2,20 @@
Section: perl
Priority: optional
Build-Depends: debhelper (>= 7)
-Build-Depends-Indep: perl, libtest-pod-coverage-perl, libtest-pod-perl
+Build-Depends-Indep: libtest-pod-coverage-perl, libtest-pod-perl,
+ perl
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
Uploaders: gregor herrmann <gregoa at debian.org>, Jonathan Yu <jawnsy at cpan.org>,
- Krzysztof Krzyzaniak (eloy) <eloy at debian.org>
-Standards-Version: 3.8.3
+ Krzysztof Krzyzaniak (eloy) <eloy at debian.org>,
+ Angel Abad <angelabad at gmail.com>
+Standards-Version: 3.8.4
Homepage: http://search.cpan.org/dist/Test-LongString/
Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libtest-longstring-perl/
Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libtest-longstring-perl/
Package: libtest-longstring-perl
Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends}
+Depends: ${misc:Depends}, ${perl:Depends}
Description: module to test for string equality
Test::LongString is a Perl test module that provides some functions useful
for testing the equality of long strings. Upon failure, it will provide more
Modified: trunk/libtest-longstring-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-longstring-perl/debian/copyright?rev=51923&op=diff
==============================================================================
--- trunk/libtest-longstring-perl/debian/copyright (original)
+++ trunk/libtest-longstring-perl/debian/copyright Sun Jan 31 13:14:19 2010
@@ -4,13 +4,14 @@
Name: Test-LongString
Files: *
-Copyright: 2002-2006, Rafael Garcia-Suarez <rgs at consttype.org>
+Copyright: 2002-2010, Rafael Garcia-Suarez <rgs at consttype.org>
License: Artistic or GPL-1+
Files: debian/*
-Copyright: 2010, Jonathan Yu <jawnsy at cpan.org>
- 2006-2008, gregor herrmann <gregoa at debian.org>
+Copyright: 2006, 2008, gregor herrmann <gregor+debian at comodo.priv.at>
2006, Krzysztof Krzyzaniak (eloy) <eloy at debian.org>
+ 2010, Angel Abad <angelabad at gmail.com>
+ 2010, Jonathan Yu <jawnsy at cpan.org>
License: Artistic or GPL-1+
License: Artistic
Modified: trunk/libtest-longstring-perl/lib/Test/LongString.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-longstring-perl/lib/Test/LongString.pm?rev=51923&op=diff
==============================================================================
--- trunk/libtest-longstring-perl/lib/Test/LongString.pm (original)
+++ trunk/libtest-longstring-perl/lib/Test/LongString.pm Sun Jan 31 13:14:19 2010
@@ -1,9 +1,9 @@
package Test::LongString;
use strict;
-use vars qw($VERSION @ISA @EXPORT $Max $Context);
-
-$VERSION = '0.12';
+use vars qw($VERSION @ISA @EXPORT $Max $Context $LCSS);
+
+$VERSION = '0.13';
use Test::Builder;
my $Tester = new Test::Builder();
@@ -19,9 +19,13 @@
# Amount of context provided when starting displaying a string in the middle
$Context = 10;
+# Boolean: should we show LCSS context ?
+$LCSS = 1;
+
sub import {
(undef, my %args) = @_;
$Max = $args{max} if defined $args{max};
+ $LCSS = $args{lcss} if defined $args{lcss};
@_ = $_[0];
goto &Exporter::import;
}
@@ -76,27 +80,31 @@
if (!$ok) {
my ($g, $e) = (_display($str), _display($sub));
- # if _lcss() returned the actual substring,
- # all we'd have to do is:
- # my $l = _display( _lcss($str, $sub) );
-
- my ($off, $len) = _lcss($str, $sub);
- my $l = _display( substr($str, $off, $len) );
-
$Tester->diag(<<DIAG);
searched: $g
can't find: $e
+DIAG
+
+ if ($LCSS) {
+ # if _lcss() returned the actual substring,
+ # all we'd have to do is:
+ # my $l = _display( _lcss($str, $sub) );
+
+ my ($off, $len) = _lcss($str, $sub);
+ my $l = _display( substr($str, $off, $len) );
+
+ $Tester->diag(<<DIAG);
LCSS: $l
DIAG
-
- # if there's room left, show some surrounding context
- if ($len < $Max) {
- my $available = int( ($Max - $len) / 2 );
- my $begin = ($off - ($available*2) > 0) ? $off - ($available*2)
- : ($off - $available > 0) ? $off - $available : 0;
- my $c = _display( substr($str, $begin, $Max) );
-
- $Tester->diag("LCSS context: $c");
+ # if there's room left, show some surrounding context
+ if ($len < $Max) {
+ my $available = int( ($Max - $len) / 2 );
+ my $begin = ($off - ($available*2) > 0) ? $off - ($available*2)
+ : ($off - $available > 0) ? $off - $available : 0;
+ my $c = _display( substr($str, $begin, $Max) );
+
+ $Tester->diag("LCSS context: $c");
+ }
}
}
}
@@ -373,6 +381,23 @@
# searched: "To be, or not to be: that is the question:\x{0a}Whether"...
# and can't find: "Romeo"
+As of version 0.12, C<contains_string()> will also report the Longest Common
+SubString (LCSS) found in I<$string> and, if the LCSS is short enough, the
+surroundings will also be shown under I<LCSS Context>. This should help debug
+tests for really long strings like HTML output, so you'll get something like:
+
+ contains_string( $html, '<div id="MainContent">' );
+ # Failed test at t/foo.t line 10.
+ # searched: "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Stric"...
+ # can't find: "<div id="MainContent">"
+ # LCSS: "ainContent""
+ # LCSS context: "dolor sit amet</span>\x{0a}<div id="mainContent" class="
+
+You can turn off LCSS reporting by setting C<$Test::LongString::LCSS> to 0,
+or by specifying an argument to C<use>:
+
+ use Test::LongString lcss => 0;
+
=head2 lacks_string( $string, $substring [, $label ] )
C<lacks_string()> makes sure that I<$substring> does NOT exist in
Modified: trunk/libtest-longstring-perl/t/02import.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-longstring-perl/t/02import.t?rev=51923&op=diff
==============================================================================
--- trunk/libtest-longstring-perl/t/02import.t (original)
+++ trunk/libtest-longstring-perl/t/02import.t Sun Jan 31 13:14:19 2010
@@ -2,10 +2,10 @@
use strict;
-use Test::More tests => 1;
+use Test::More tests => 2;
use Test::Builder::Tester;
use Test::Builder::Tester::Color;
-use Test::LongString max => 5;
+use Test::LongString max => 5, lcss => 0;
test_out("not ok 1 - foobar is foobar");
test_fail(6);
@@ -16,3 +16,5 @@
# strings begin to differ at char 5));
is_string("foobur", "foobar", "foobar is foobar");
test_test("5 chars in output");
+
+is($Test::LongString::LCSS, 0, "\$LCSS global set");
Modified: trunk/libtest-longstring-perl/t/04contains.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-longstring-perl/t/04contains.t?rev=51923&op=diff
==============================================================================
--- trunk/libtest-longstring-perl/t/04contains.t (original)
+++ trunk/libtest-longstring-perl/t/04contains.t Sun Jan 31 13:14:19 2010
@@ -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;
@@ -20,7 +20,18 @@
test_diag(qq( LCSS: "o"));
test_diag(qq(LCSS context: "Dog food"));
contains_string("Dog food","Nachos", "Any nachos?");
-test_test("Substring doesn't match (with LCS)");
+test_test("Substring doesn't match (with LCSS)");
+
+{
+ local $Test::LongString::LCSS = 0;
+ # Not in there, with LCSS output disabled
+ test_out("not ok 1 - Any nachos?");
+ test_fail(3);
+ test_diag(qq( searched: "Dog food"));
+ test_diag(qq( can't find: "Nachos"));
+ contains_string("Dog food","Nachos", "Any nachos?");
+ test_test("Substring doesn't match (with LCSS)");
+}
# Source string undef
test_out("not ok 1 - Look inside undef");
@@ -35,5 +46,3 @@
test_diag(qq(String to look for is undef));
contains_string('"Mesh" is not a color', undef, "Look for undef");
test_test("Substring undef fails");
-
-
More information about the Pkg-perl-cvs-commits
mailing list