r50818 - in /trunk/libtest-longstring-perl: Changes MANIFEST MANIFEST.SKIP META.yml Makefile.PL debian/changelog debian/compat debian/control debian/rules lib/Test/LongString.pm t/04contains.t
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Tue Jan 12 18:25:25 UTC 2010
Author: jawnsy-guest
Date: Tue Jan 12 18:25:08 2010
New Revision: 50818
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=50818
Log:
* New upstream release
* Standards-Version 3.8.3 (drop perl version dep)
* Use new short debhelper 7 rules format
* Rewrite control description
* Add myself to Uploaders and Copyright
* Change my email address.
Added:
trunk/libtest-longstring-perl/MANIFEST.SKIP
- copied unchanged from r50816, branches/upstream/libtest-longstring-perl/current/MANIFEST.SKIP
Modified:
trunk/libtest-longstring-perl/Changes
trunk/libtest-longstring-perl/MANIFEST
trunk/libtest-longstring-perl/META.yml
trunk/libtest-longstring-perl/Makefile.PL
trunk/libtest-longstring-perl/debian/changelog
trunk/libtest-longstring-perl/debian/compat
trunk/libtest-longstring-perl/debian/control
trunk/libtest-longstring-perl/debian/rules
trunk/libtest-longstring-perl/lib/Test/LongString.pm
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=50818&op=diff
==============================================================================
--- trunk/libtest-longstring-perl/Changes (original)
+++ trunk/libtest-longstring-perl/Changes Tue Jan 12 18:25:08 2010
@@ -11,3 +11,7 @@
0.11
Require a more recent Test::Builder::Tester,
since tests fail with 1.03.
+
+0.12
+ Show longest common substring in diagnostics
+ (Breno G. de Oliveira)
Modified: trunk/libtest-longstring-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-longstring-perl/MANIFEST?rev=50818&op=diff
==============================================================================
--- trunk/libtest-longstring-perl/MANIFEST (original)
+++ trunk/libtest-longstring-perl/MANIFEST Tue Jan 12 18:25:08 2010
@@ -1,6 +1,7 @@
lib/Test/LongString.pm
Makefile.PL
MANIFEST
+MANIFEST.SKIP
README
t/01teststring.t
t/02import.t
Modified: trunk/libtest-longstring-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-longstring-perl/META.yml?rev=50818&op=diff
==============================================================================
--- trunk/libtest-longstring-perl/META.yml (original)
+++ trunk/libtest-longstring-perl/META.yml Tue Jan 12 18:25:08 2010
@@ -1,12 +1,15 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: Test-LongString
-version: 0.11
-version_from: lib/Test/LongString.pm
-installdirs: site
-requires:
+--- #YAML:1.0
+name: Test-LongString
+version: 0.12
+abstract: ~
+license: perl
+author:
+ - Rafael Garcia-Suarez <rgs at consttype.org>
+generated_by: ExtUtils::MakeMaker version 6.42
+distribution_type: module
+requires:
Test::Builder: 0.12
Test::Builder::Tester: 1.04
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30_01
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ version: 1.3
Modified: trunk/libtest-longstring-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-longstring-perl/Makefile.PL?rev=50818&op=diff
==============================================================================
--- trunk/libtest-longstring-perl/Makefile.PL (original)
+++ trunk/libtest-longstring-perl/Makefile.PL Tue Jan 12 18:25:08 2010
@@ -1,10 +1,12 @@
use ExtUtils::MakeMaker;
WriteMakefile(
+ AUTHOR => 'Rafael Garcia-Suarez <rgs at consttype.org>',
NAME => "Test::LongString",
VERSION_FROM => "lib/Test/LongString.pm",
PREREQ_PM => {
'Test::Builder' => 0.12,
'Test::Builder::Tester' => 1.04,
},
+ LICENSE => 'perl',
);
Modified: trunk/libtest-longstring-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-longstring-perl/debian/changelog?rev=50818&op=diff
==============================================================================
--- trunk/libtest-longstring-perl/debian/changelog (original)
+++ trunk/libtest-longstring-perl/debian/changelog Tue Jan 12 18:25:08 2010
@@ -1,16 +1,21 @@
-libtest-longstring-perl (0.11-3) UNRELEASED; urgency=low
+libtest-longstring-perl (0.12-1) UNRELEASED; urgency=low
+
+ [ Jonathan Yu ]
+ * New upstream release
+ * Standards-Version 3.8.3 (drop perl version dep)
+ * Use new short debhelper 7 rules format
+ * Rewrite control description
+ * Add myself to Uploaders and Copyright
[ gregor herrmann ]
* debian/control: Changed: Switched Vcs-Browser field to ViewSVN
(source stanza).
+ * Change my email address.
[ Nathan Handler ]
* debian/watch: Update to ignore development releases.
- [ gregor herrmann ]
- * Change my email address.
-
- -- gregor herrmann <gregoa at debian.org> Sun, 16 Nov 2008 20:47:51 +0100
+ -- Jonathan Yu <jawnsy at cpan.org> Tue, 12 Jan 2010 13:28:46 -0500
libtest-longstring-perl (0.11-2) unstable; urgency=low
Modified: trunk/libtest-longstring-perl/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-longstring-perl/debian/compat?rev=50818&op=diff
==============================================================================
--- trunk/libtest-longstring-perl/debian/compat (original)
+++ trunk/libtest-longstring-perl/debian/compat Tue Jan 12 18:25:08 2010
@@ -1,1 +1,1 @@
-5
+7
Modified: trunk/libtest-longstring-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-longstring-perl/debian/control?rev=50818&op=diff
==============================================================================
--- trunk/libtest-longstring-perl/debian/control (original)
+++ trunk/libtest-longstring-perl/debian/control Tue Jan 12 18:25:08 2010
@@ -1,21 +1,24 @@
Source: libtest-longstring-perl
Section: perl
Priority: optional
-Build-Depends: debhelper (>= 5.0)
-Build-Depends-Indep: perl (>= 5.8.0-7), libtest-simple-perl, libtest-pod-perl, libtest-pod-coverage-perl
+Build-Depends: debhelper (>= 7)
+Build-Depends-Indep: perl, libtest-pod-coverage-perl, libtest-pod-perl
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Krzysztof Krzyzaniak (eloy) <eloy at debian.org>, gregor herrmann <gregoa at debian.org>
-Standards-Version: 3.7.3
+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
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}, libtest-simple-perl
-Description: Tests strings for equality, with more helpful failures
- 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. If you've ever had to search
- for text in a multi-line string like an HTML document, or find
- specific items in binary data, this is the module for you.
+Depends: ${perl:Depends}, ${misc: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
+ useful diagnostic output by:
+ .
+ * Reporting lengths of the strings that have been compared
+ * Reporting length of the common prefix of strings
+ * Automatically escaping non-ASCII characters as \x{xx}
Modified: trunk/libtest-longstring-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-longstring-perl/debian/rules?rev=50818&op=diff
==============================================================================
--- trunk/libtest-longstring-perl/debian/rules (original)
+++ trunk/libtest-longstring-perl/debian/rules Tue Jan 12 18:25:08 2010
@@ -1,70 +1,4 @@
#!/usr/bin/make -f
-# This debian/rules file is provided as a template for normal perl
-# packages. It was created by Marc Brockschmidt <marc at dch-faq.de> for
-# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
-# be used freely wherever it is useful.
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-# If set to a true value then MakeMaker's prompt function will
-# always return the default without waiting for user input.
-export PERL_MM_USE_DEFAULT=1
-
-PACKAGE=$(shell dh_listpackages)
-
-ifndef PERL
-PERL = /usr/bin/perl
-endif
-
-TMP =$(CURDIR)/debian/$(PACKAGE)
-
-build: build-stamp
-build-stamp:
- dh_testdir
-
- $(PERL) Makefile.PL INSTALLDIRS=vendor
- $(MAKE)
- $(MAKE) test
-
- touch $@
-
-clean:
- dh_testdir
- dh_testroot
-
- dh_clean build-stamp install-stamp
- [ ! -f Makefile ] || $(MAKE) realclean
-
-install: install-stamp
-install-stamp: build-stamp
- dh_testdir
- dh_testroot
- dh_clean -k
-
- $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
- [ ! -d $(TMP)/usr/lib/perl5 ] || rmdir --ignore-fail-on-non-empty --parents --verbose $(TMP)/usr/lib/perl5
-
- touch $@
-
-binary-arch:
-# We have nothing to do here for an architecture-independent package
-
-binary-indep: build install
- dh_testdir
- dh_testroot
- dh_installdocs
- dh_installchangelogs Changes
- dh_perl
- dh_compress
- dh_fixperms
- dh_installdeb
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-source diff:
- @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
+%:
+ dh $@
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=50818&op=diff
==============================================================================
--- trunk/libtest-longstring-perl/lib/Test/LongString.pm (original)
+++ trunk/libtest-longstring-perl/lib/Test/LongString.pm Tue Jan 12 18:25:08 2010
@@ -3,7 +3,7 @@
use strict;
use vars qw($VERSION @ISA @EXPORT $Max $Context);
-$VERSION = '0.11';
+$VERSION = '0.12';
use Test::Builder;
my $Tester = new Test::Builder();
@@ -75,14 +75,67 @@
$Tester->ok($ok, $name);
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
+ 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");
+ }
}
}
return $ok;
}
+
+sub _lcss($$) {
+ my ($S, $T) = (@_);
+ my @L;
+ my ($offset, $length) = (0,0);
+
+ # prevent us from having to zero a $ix$j matrix
+ no warnings 'uninitialized';
+
+ # now the actual LCSS algorithm
+ foreach my $i (0 .. length($S) ) {
+ foreach my $j (0 .. length($T)) {
+ if (substr($S, $i, 1) eq substr($T, $j, 1)) {
+ if ($i == 0 or $j == 0) {
+ $L[$i][$j] = 1;
+ }
+ else {
+ $L[$i][$j] = $L[$i-1][$j-1] + 1;
+ }
+ if ($L[$i][$j] > $length) {
+ $length = $L[$i][$j];
+ $offset = $i - $length + 1;
+ }
+ }
+ }
+ }
+
+ # if you want to display just the lcss:
+ # return substr($S, $offset, $length);
+
+ # but to display the surroundings, we need to:
+ return ($offset, $length);
+}
+
sub lacks_string($$;$) {
my ($str,$sub,$name) = @_;
@@ -358,6 +411,10 @@
This program is free software; you may redistribute it and/or modify it under
the same terms as Perl itself.
+A git repository for this module is available at
+
+ http://consttype.org/git/Test-LongString.git
+
=head1 SEE ALSO
L<Test::Builder>, L<Test::Builder::Tester>, L<Test::More>.
Modified: trunk/libtest-longstring-perl/t/04contains.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-longstring-perl/t/04contains.t?rev=50818&op=diff
==============================================================================
--- trunk/libtest-longstring-perl/t/04contains.t (original)
+++ trunk/libtest-longstring-perl/t/04contains.t Tue Jan 12 18:25:08 2010
@@ -14,11 +14,13 @@
# Not in there
test_out("not ok 1 - Any nachos?");
-test_fail(3);
+test_fail(5);
test_diag(qq( searched: "Dog food"));
test_diag(qq( can't find: "Nachos"));
+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");
+test_test("Substring doesn't match (with LCS)");
# Source string undef
test_out("not ok 1 - Look inside undef");
@@ -33,3 +35,5 @@
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