r2636 - in /packages/libtest-longstring-perl: ./ branches/ branches/upstream/ branches/upstream/current/ branches/upstream/current/lib/ branches/upstream/current/lib/Test/ branches/upstream/current/t/ tags/

eloy at users.alioth.debian.org eloy at users.alioth.debian.org
Tue Apr 25 14:20:34 UTC 2006


Author: eloy
Date: Tue Apr 25 14:20:32 2006
New Revision: 2636

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=2636
Log:
[svn-inject] Installing original source of libtest-longstring-perl

Added:
    packages/libtest-longstring-perl/
    packages/libtest-longstring-perl/branches/
    packages/libtest-longstring-perl/branches/upstream/
    packages/libtest-longstring-perl/branches/upstream/current/
    packages/libtest-longstring-perl/branches/upstream/current/Changes
    packages/libtest-longstring-perl/branches/upstream/current/MANIFEST
    packages/libtest-longstring-perl/branches/upstream/current/MANIFEST.SKIP
    packages/libtest-longstring-perl/branches/upstream/current/META.yml
    packages/libtest-longstring-perl/branches/upstream/current/Makefile.PL
    packages/libtest-longstring-perl/branches/upstream/current/README
    packages/libtest-longstring-perl/branches/upstream/current/lib/
    packages/libtest-longstring-perl/branches/upstream/current/lib/Test/
    packages/libtest-longstring-perl/branches/upstream/current/lib/Test/LongString.pm
    packages/libtest-longstring-perl/branches/upstream/current/t/
    packages/libtest-longstring-perl/branches/upstream/current/t/01teststring.t
    packages/libtest-longstring-perl/branches/upstream/current/t/02import.t
    packages/libtest-longstring-perl/branches/upstream/current/t/03like.t
    packages/libtest-longstring-perl/branches/upstream/current/t/04contains.t
    packages/libtest-longstring-perl/branches/upstream/current/t/05lacks.t
    packages/libtest-longstring-perl/branches/upstream/current/t/pod-coverage.t
    packages/libtest-longstring-perl/branches/upstream/current/t/pod.t
    packages/libtest-longstring-perl/tags/

Added: packages/libtest-longstring-perl/branches/upstream/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtest-longstring-perl/branches/upstream/current/Changes?rev=2636&op=file
==============================================================================
--- packages/libtest-longstring-perl/branches/upstream/current/Changes (added)
+++ packages/libtest-longstring-perl/branches/upstream/current/Changes Tue Apr 25 14:20:32 2006
@@ -1,0 +1,5 @@
+0.08
+    Fix and improve diagostics
+
+0.09
+    Add an is_string_nows() function (RT #14018)

Added: packages/libtest-longstring-perl/branches/upstream/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtest-longstring-perl/branches/upstream/current/MANIFEST?rev=2636&op=file
==============================================================================
--- packages/libtest-longstring-perl/branches/upstream/current/MANIFEST (added)
+++ packages/libtest-longstring-perl/branches/upstream/current/MANIFEST Tue Apr 25 14:20:32 2006
@@ -1,0 +1,14 @@
+lib/Test/LongString.pm
+Makefile.PL
+MANIFEST
+MANIFEST.SKIP
+README
+t/01teststring.t
+t/02import.t
+t/03like.t
+t/04contains.t
+t/05lacks.t
+t/pod.t
+t/pod-coverage.t
+Changes
+META.yml                                 Module meta-data (added by MakeMaker)

Added: packages/libtest-longstring-perl/branches/upstream/current/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtest-longstring-perl/branches/upstream/current/MANIFEST.SKIP?rev=2636&op=file
==============================================================================
--- packages/libtest-longstring-perl/branches/upstream/current/MANIFEST.SKIP (added)
+++ packages/libtest-longstring-perl/branches/upstream/current/MANIFEST.SKIP Tue Apr 25 14:20:32 2006
@@ -1,0 +1,15 @@
+# Avoid version control files.
+\B\.svn\b
+
+# Avoid Makemaker generated and utility files.
+^MANIFEST\.bak
+^Makefile$
+^blib/
+^MakeMaker-\d
+^pm_to_blib$
+
+# Avoid temp and backup files.
+~$
+\.old$
+\#$
+^\.#

Added: packages/libtest-longstring-perl/branches/upstream/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtest-longstring-perl/branches/upstream/current/META.yml?rev=2636&op=file
==============================================================================
--- packages/libtest-longstring-perl/branches/upstream/current/META.yml (added)
+++ packages/libtest-longstring-perl/branches/upstream/current/META.yml Tue Apr 25 14:20:32 2006
@@ -1,0 +1,12 @@
+# 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.09
+version_from: lib/Test/LongString.pm
+installdirs:  site
+requires:
+    Test::Builder:                 0.12
+    Test::Builder::Tester:         1
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17

Added: packages/libtest-longstring-perl/branches/upstream/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtest-longstring-perl/branches/upstream/current/Makefile.PL?rev=2636&op=file
==============================================================================
--- packages/libtest-longstring-perl/branches/upstream/current/Makefile.PL (added)
+++ packages/libtest-longstring-perl/branches/upstream/current/Makefile.PL Tue Apr 25 14:20:32 2006
@@ -1,0 +1,10 @@
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+    NAME	    => "Test::LongString",
+    VERSION_FROM    => "lib/Test/LongString.pm",
+    PREREQ_PM	    => {
+	'Test::Builder'		=> 0.12,
+	'Test::Builder::Tester'	=> 1.00,
+    },
+);

Added: packages/libtest-longstring-perl/branches/upstream/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtest-longstring-perl/branches/upstream/current/README?rev=2636&op=file
==============================================================================
--- packages/libtest-longstring-perl/branches/upstream/current/README (added)
+++ packages/libtest-longstring-perl/branches/upstream/current/README Tue Apr 25 14:20:32 2006
@@ -1,0 +1,25 @@
+Test::LongString v0.09
+======================
+
+A library to test long strings.
+
+INSTALLATION
+
+To install this module type the following:
+
+    perl Makefile.PL
+    make
+    make test
+    make install
+
+DEPENDENCIES
+
+Needs Test::More, Test::Builder, and, to run the tests, Test::Builder::Tester.
+Test::Pod and Test::Pod::Coverage are optional.
+
+COPYRIGHT AND LICENCE
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+Copyright (c) 2002, 2003, 2004, 2005 Rafael Garcia-Suarez

Added: packages/libtest-longstring-perl/branches/upstream/current/lib/Test/LongString.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtest-longstring-perl/branches/upstream/current/lib/Test/LongString.pm?rev=2636&op=file
==============================================================================
--- packages/libtest-longstring-perl/branches/upstream/current/lib/Test/LongString.pm (added)
+++ packages/libtest-longstring-perl/branches/upstream/current/lib/Test/LongString.pm Tue Apr 25 14:20:32 2006
@@ -1,0 +1,377 @@
+package Test::LongString;
+
+use strict;
+use vars qw($VERSION @ISA @EXPORT $Max $Context);
+
+$VERSION = 0.09;
+
+use Test::Builder;
+my $Tester = new Test::Builder();
+
+use Exporter;
+ at ISA    = ('Exporter');
+ at EXPORT = qw( is_string is_string_nows like_string unlike_string
+    contains_string lacks_string );
+
+# Maximum string length displayed in diagnostics
+$Max = 50;
+
+# Amount of context provided when starting displaying a string in the middle
+$Context = 10;
+
+sub import {
+    (undef, my %args) = @_;
+    $Max = $args{max} if defined $args{max};
+    @_ = $_[0];
+    goto &Exporter::import;
+}
+
+# _display($string, [$offset = 0])
+# Formats a string for display. Begins at $offset minus $Context.
+# This function ought to be configurable, à la od(1).
+
+sub _display {
+    my $s = shift;
+    if (!defined $s) { return 'undef'; }
+    if (length($s) > $Max) {
+	my $offset = shift || 0;
+	if (defined $Context) {
+	    $offset -= $Context;
+	    $offset < 0 and $offset = 0;
+	}
+	else {
+	    $offset = 0;
+	}
+	$s = sprintf(qq("%.${Max}s"...), substr($s, $offset));
+	$s = "...$s" if $offset;
+    }
+    else {
+	$s = qq("$s");
+    }
+    $s =~ s/([\0-\037\200-\377])/sprintf('\x{%02x}',ord $1)/eg;
+    return $s;
+}
+
+# I'm not too happy with this function. And you ?
+sub _common_prefix_length {
+    my ($x, $y) = (shift, shift);
+    my $r = 0;
+    while (length($x) && length($y)) {
+	my ($x1,$x2) = $x =~ /(.)(.*)/s;
+	my ($y1,$y2) = $y =~ /(.)(.*)/s;
+	if ($x1 eq $y1) {
+	    $x = $x2;
+	    $y = $y2;
+	    ++$r;
+	}
+	else {
+	    last;
+	}
+    }
+    $r;
+}
+
+sub contains_string($$;$) {
+    my ($str,$sub,$name) = @_;
+
+    my $ok;
+    if (!defined $str) {
+        $Tester->ok($ok = 0, $name);
+        $Tester->diag("String to look in is undef");
+    } elsif (!defined $sub) {
+        $Tester->ok($ok = 0, $name);
+        $Tester->diag("String to look for is undef");
+    } else {
+        my $index = index($str, $sub);
+        $ok = ($index >= 0);
+        $Tester->ok($ok, $name);
+        if (!$ok) {
+            my ($g, $e) = (_display($str), _display($sub));
+            $Tester->diag(<<DIAG);
+    searched: $g
+  can't find: $e
+DIAG
+        }
+    }
+    return $ok;
+}
+
+sub lacks_string($$;$) {
+    my ($str,$sub,$name) = @_;
+
+    my $ok;
+    if (!defined $str) {
+        $Tester->ok($ok = 0, $name);
+        $Tester->diag("String to look in is undef");
+    } elsif (!defined $sub) {
+        $Tester->ok($ok = 0, $name);
+        $Tester->diag("String to look for is undef");
+    } else {
+        my $index = index($str, $sub);
+        $ok = ($index < 0);
+        $Tester->ok($ok, $name);
+        if (!$ok) {
+            my ($g, $e) = (_display($str), _display($sub));
+            $Tester->diag(<<DIAG);
+    searched: $g
+   and found: $e
+ at position: $index
+DIAG
+        }
+    }
+    return $ok;
+}
+
+sub is_string ($$;$) {
+    my ($got, $expected, $name) = @_;
+    if (!defined $got || !defined $expected) {
+	my $ok = !defined $got && !defined $expected;
+	$Tester->ok($ok, $name);
+	if (!$ok) {
+	    my ($g, $e) = (_display($got), _display($expected));
+	    $Tester->diag(<<DIAG);
+         got: $g
+    expected: $e
+DIAG
+	}
+	return $ok;
+    }
+    if ($got eq $expected) {
+	$Tester->ok(1, $name);
+	return 1;
+    }
+    else {
+	$Tester->ok(0, $name);
+	my $common_prefix = _common_prefix_length($got,$expected);
+	my ($g, $e) = (
+	    _display($got, $common_prefix),
+	    _display($expected, $common_prefix),
+	);
+	$Tester->diag(<<DIAG);
+         got: $g
+      length: ${\(length $got)}
+    expected: $e
+      length: ${\(length $expected)}
+    strings begin to differ at char ${\($common_prefix + 1)}
+DIAG
+	return 0;
+    }
+}
+
+sub is_string_nows ($$;$) {
+    my ($got, $expected, $name) = @_;
+    if (!defined $got || !defined $expected) {
+	my $ok = !defined $got && !defined $expected;
+	$Tester->ok($ok, $name);
+	if (!$ok) {
+	    my ($g, $e) = (_display($got), _display($expected));
+	    $Tester->diag(<<DIAG);
+         got: $g
+    expected: $e
+DIAG
+	}
+	return $ok;
+    }
+    s/\s+//g for (my $got_nows = $got), (my $expected_nows = $expected);
+    if ($got_nows eq $expected_nows) {
+	$Tester->ok(1, $name);
+	return 1;
+    }
+    else {
+	$Tester->ok(0, $name);
+	my $common_prefix = _common_prefix_length($got_nows,$expected_nows);
+	my ($g, $e) = (
+	    _display($got_nows, $common_prefix),
+	    _display($expected_nows, $common_prefix),
+	);
+	$Tester->diag(<<DIAG);
+after whitespace removal:
+         got: $g
+      length: ${\(length $got_nows)}
+    expected: $e
+      length: ${\(length $expected_nows)}
+    strings begin to differ at char ${\($common_prefix + 1)}
+DIAG
+	return 0;
+    }
+}
+
+sub like_string ($$;$) {
+    _like($_[0],$_[1],'=~',$_[2]);
+}
+
+sub unlike_string ($$;$) {
+    _like($_[0],$_[1],'!~',$_[2]);
+}
+
+# mostly from Test::Builder::_regex_ok
+sub _like {
+    local $Test::Builder::Level = $Test::Builder::Level + 1;
+    my ($got, $regex, $cmp, $name) = @_;
+    my $ok = 0;
+    my $usable_regex = $Tester->maybe_regex($regex);
+    unless (defined $usable_regex) {
+	$ok = $Tester->ok( 0, $name );
+	$Tester->diag("    '$regex' doesn't look much like a regex to me.");
+	return $ok;
+    }
+    {
+	local $^W = 0;
+	my $test = $got =~ /$usable_regex/ ? 1 : 0;
+	$test = !$test if $cmp eq '!~';
+	$ok = $Tester->ok( $test, $name );
+    }
+    unless( $ok ) {
+	my $g = _display($got);
+	my $match = $cmp eq '=~' ? "doesn't match" : "matches";
+	my $l = defined $got ? length $got : '-';
+	$Tester->diag(sprintf(<<DIAGNOSTIC, $g, $match, $regex));
+         got: %s
+      length: $l
+    %13s '%s'
+DIAGNOSTIC
+    }
+    return $ok;
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Test::LongString - tests strings for equality, with more helpful failures
+
+=head1 SYNOPSIS
+
+    use Test::More tests => 1;
+    use Test::LongString;
+    like_string( $html, qr/(perl|cpan)\.org/ );
+
+    #     Failed test (html-test.t at line 12)
+    #          got: "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Trans"...
+    #       length: 58930
+    #     doesn't match '(?-xism:(perl|cpan)\.org)'
+
+=head1 DESCRIPTION
+
+This module provides some drop-in replacements for the string
+comparison functions of L<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.
+
+=head1 FUNCTIONS
+
+=head2 is_string( $string, $expected [, $label ] )
+
+C<is_string()> is equivalent to C<Test::More::is()>, but with more
+helpful diagnostics in case of failure.
+
+=over
+
+=item *
+
+It doesn't print the entire strings in the failure message.
+
+=item *
+
+It reports the lengths of the strings that have been compared.
+
+=item *
+
+It reports the length of the common prefix of the strings.
+
+=item *
+
+In the diagnostics, non-ASCII characters are escaped as C<\x{xx}>.
+
+=back
+
+For example:
+
+    is_string( $soliloquy, $juliet );
+
+    #     Failed test (soliloquy.t at line 15)
+    #          got: "To be, or not to be: that is the question:\x{0a}Whether"...
+    #       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
+
+=head2 is_string_nows( $string, $expected [, $label ] )
+
+Like C<is_string()>, but removes whitepace (in the C<\s> sense) from the
+arguments before comparing them.
+
+=head2 like_string( $string, qr/regex/ [, $label ] )
+
+=head2 unlike_string( $string, qr/regex/ [, $label ] )
+
+C<like_string()> and C<unlike_string()> are replacements for
+C<Test::More:like()> and C<unlike()> that only print the beginning
+of the received string in the output.  Unfortunately, they can't
+print out the position where the regex failed to match.
+
+    like_string( $soliloquy, qr/Romeo|Juliet|Mercutio|Tybalt/ );
+
+    #     Failed test (soliloquy.t at line 15)
+    #          got: "To be, or not to be: that is the question:\x{0a}Whether"...
+    #       length: 1490
+    #     doesn't match '(?-xism:Romeo|Juliet|Mercutio|Tybalt)'
+
+=head2 contains_string( $string, $substring [, $label ] )
+
+C<contains_string()> searches for I<$substring> in I<$string>.  It's
+the same as C<like_string()>, except that it's not a regular
+expression search.
+
+    contains_string( $soliloquy, "Romeo" );
+
+    #     Failed test (soliloquy.t at line 10)
+    #         searched: "To be, or not to be: that is the question:\x{0a}Whether"...
+    #   and can't find: "Romeo"
+
+=head2 lacks_string( $string, $substring [, $label ] )
+
+C<lacks_string()> makes sure that I<$substring> does NOT exist in
+I<$string>.  It's the same as C<like_string()>, except that it's not a
+regular expression search.
+
+    lacks_string( $soliloquy, "slings" );
+
+    #     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
+
+=head1 CONTROLLING OUTPUT
+
+By default, only the first 50 characters of the compared strings
+are shown in the failure message.  This value is in
+C<$Test::LongString::Max>, and can be set at run-time.
+
+You can also set it by specifying an argument to C<use>:
+
+    use Test::LongString max => 100;
+
+When the compared strings begin to differ after a large prefix,
+Test::LongString will not print them from the beginning, but will start at the
+middle, more precisely at C<$Test::LongString::Context> characters before the
+first difference. By default this value is 10 characters. If you want
+Test::LongString to always print the beginning of compared strings no matter
+where they differ, undefine C<$Test::LongString::Context>.
+
+=head1 AUTHOR
+
+Written by Rafael Garcia-Suarez. Thanks to Mark Fowler (and to Joss Whedon) for
+the inspirational L<Acme::Test::Buffy>. Thanks to Andy Lester for lots of patches.
+
+This program is free software; you may redistribute it and/or modify it under
+the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+L<Test::Builder>, L<Test::Builder::Tester>, L<Test::More>.
+
+=cut

Added: packages/libtest-longstring-perl/branches/upstream/current/t/01teststring.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtest-longstring-perl/branches/upstream/current/t/01teststring.t?rev=2636&op=file
==============================================================================
--- packages/libtest-longstring-perl/branches/upstream/current/t/01teststring.t (added)
+++ packages/libtest-longstring-perl/branches/upstream/current/t/01teststring.t Tue Apr 25 14:20:32 2006
@@ -1,0 +1,124 @@
+#!perl -w
+
+use strict;
+
+use Test::More tests => 11;
+use Test::Builder::Tester;
+use Test::Builder::Tester::Color;
+
+BEGIN { use_ok "Test::LongString" }
+
+test_out("ok 1 - foo is foo");
+is_string("foo", "foo", "foo is foo");
+test_test("two small strings equal");
+
+test_out("not ok 1 - foo is foo");
+test_fail(6);
+test_diag(qq(         got: "bar"
+#       length: 3
+#     expected: "foo"
+#       length: 3
+#     strings begin to differ at char 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"));
+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));
+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"...
+#       length: 70
+#     expected: "\\x{00}\\x{01}foo\\x{0a}bar"
+#       length: 9
+#     strings begin to differ at char 1));
+is_string(
+    "This is a long string that will be truncated by the display() function",
+    "\0\1foo\nbar",
+    "long binary strings",
+);
+test_test("display of long strings and of control chars");
+
+test_out("not ok 1 - spelling");
+test_fail(6);
+test_diag(qq(         got: "Element"
+#       length: 7
+#     expected: "El\\x{e9}ment"
+#       length: 7
+#     strings begin to differ at char 3));
+is_string(
+    "Element",
+    "Elément",
+    "spelling",
+);
+test_test("Escape high-ascii chars");
+
+test_out('not ok 1 - foo\nfoo is foo\nfoo');
+test_fail(6);
+test_diag(qq(         got: "foo\\x{0a}foo"
+#       length: 7
+#     expected: "foo\\x{0a}fpo"
+#       length: 7
+#     strings begin to differ at char 6));
+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"...
+#       length: 275
+#     expected: ..."he bowl alift and intoned:\\x{0a}--Introibo ad altare de"...
+#       length: 275
+#     strings begin to differ at char 233));
+is_string(
+    <<ULYS1,
+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.
+ULYS1
+    <<ULYS2,
+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 alift and intoned:
+--Introibo ad altare dei.
+ULYS2
+    "this isn't Ulysses",
+);
+test_test("Display offset in diagnostics");
+
+test_out("ok 1 - looks like Finnegans Wake");
+is_string_nows(
+    <<FW1,
+riverrun, past Eve and Adam's, from swerve of shore to bend
+of bay, brings us by a commodius vicus of recirculation back to
+Howth Castle and Environs.
+FW1
+    qq(riverrun,pastEveandAdam's,fromswerveofshoretobendofbay,bringsusbyacommodiusvicusofrecirculationbacktoHowthCastleandEnvirons.),
+    "looks like Finnegans Wake",
+);
+test_test("is_string_nows removes whitespace");
+
+test_out("not ok 1 - non-ws differs");
+test_fail(7);
+test_diag(qq(after whitespace removal:
+#          got: "abc"
+#       length: 3
+#     expected: "abd"
+#       length: 3
+#     strings begin to differ at char 3));
+is_string_nows("a b c", "abd", "non-ws differs");
+test_test("is_string_nows tests correctly");

Added: packages/libtest-longstring-perl/branches/upstream/current/t/02import.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtest-longstring-perl/branches/upstream/current/t/02import.t?rev=2636&op=file
==============================================================================
--- packages/libtest-longstring-perl/branches/upstream/current/t/02import.t (added)
+++ packages/libtest-longstring-perl/branches/upstream/current/t/02import.t Tue Apr 25 14:20:32 2006
@@ -1,0 +1,18 @@
+#!perl -w
+
+use strict;
+
+use Test::More tests => 1;
+use Test::Builder::Tester;
+use Test::Builder::Tester::Color;
+use Test::LongString max => 5;
+
+test_out("not ok 1 - foobar is foobar");
+test_fail(6);
+test_diag(qq(         got: "foobu"...
+#       length: 6
+#     expected: "fooba"...
+#       length: 6
+#     strings begin to differ at char 5));
+is_string("foobur", "foobar", "foobar is foobar");
+test_test("5 chars in output");

Added: packages/libtest-longstring-perl/branches/upstream/current/t/03like.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtest-longstring-perl/branches/upstream/current/t/03like.t?rev=2636&op=file
==============================================================================
--- packages/libtest-longstring-perl/branches/upstream/current/t/03like.t (added)
+++ packages/libtest-longstring-perl/branches/upstream/current/t/03like.t Tue Apr 25 14:20:32 2006
@@ -1,0 +1,44 @@
+#!perl -w
+
+use strict;
+
+use Test::More tests => 5;
+use Test::Builder::Tester;
+use Test::Builder::Tester::Color;
+use Test::LongString;
+
+test_out("ok 1 - foo matches foo");
+like_string("foo", qr/foo/, "foo matches foo");
+test_test("a small string matches");
+
+test_out("not ok 1 - foo matches foo");
+test_fail(4);
+test_diag(qq(         got: "bar"
+#       length: 3
+#     doesn't match '(?-xism:foo)'));
+like_string("bar", qr/foo/, "foo matches foo");
+test_test("a small string doesn't match");
+
+test_out("not ok 1 - foo matches foo");
+test_fail(4);
+test_diag(qq(         got: undef
+#       length: -
+#     doesn't match '(?-xism:foo)'));
+like_string(undef, qr/foo/, "foo matches foo");
+test_test("got undef");
+
+test_out("not ok 1 - long string matches a*");
+test_fail(4);
+test_diag(qq(         got: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"...
+#       length: 100
+#     doesn't match '(?-xism:^a*\$)'));
+like_string(("a"x60)."b".("a"x39), qr/^a*$/, "long string matches a*");
+test_test("a huge string doesn't match");
+
+test_out("not ok 1 - foo doesn't match bar");
+test_fail(4);
+test_diag(qq(         got: "bar"
+#       length: 3
+#           matches '(?-xism:bar)'));
+unlike_string("bar", qr/bar/, "foo doesn't match bar");
+test_test("a small string matches while it shouldn't");

Added: packages/libtest-longstring-perl/branches/upstream/current/t/04contains.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtest-longstring-perl/branches/upstream/current/t/04contains.t?rev=2636&op=file
==============================================================================
--- packages/libtest-longstring-perl/branches/upstream/current/t/04contains.t (added)
+++ packages/libtest-longstring-perl/branches/upstream/current/t/04contains.t Tue Apr 25 14:20:32 2006
@@ -1,0 +1,35 @@
+#!perl -Tw
+
+use strict;
+
+use Test::More tests => 4;
+use Test::Builder::Tester;
+use Test::Builder::Tester::Color;
+use Test::LongString;
+
+# In there
+test_out("ok 1 - What's in my dog food?");
+contains_string("Dog food", "foo", "What's in my dog food?");
+test_test("a small string matches");
+
+# Not in there
+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");
+
+# Source string undef
+test_out("not ok 1 - Look inside undef");
+test_fail(2);
+test_diag(qq(String to look in is undef));
+contains_string(undef,"Orange everything", "Look inside undef");
+test_test("Source string undef fails");
+
+# Searching string undef
+test_out("not ok 1 - Look for undef");
+test_fail(2);
+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");

Added: packages/libtest-longstring-perl/branches/upstream/current/t/05lacks.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtest-longstring-perl/branches/upstream/current/t/05lacks.t?rev=2636&op=file
==============================================================================
--- packages/libtest-longstring-perl/branches/upstream/current/t/05lacks.t (added)
+++ packages/libtest-longstring-perl/branches/upstream/current/t/05lacks.t Tue Apr 25 14:20:32 2006
@@ -1,0 +1,36 @@
+#!perl -Tw
+
+use strict;
+
+use Test::More tests => 4;
+use Test::Builder::Tester;
+use Test::Builder::Tester::Color;
+use Test::LongString;
+
+# In there
+test_out("ok 1 - Any chocolate in my peanut butter?");
+lacks_string("Reese's Peanut Butter Cups", "Chocolate", "Any chocolate in my peanut butter?");
+test_test("Lacking");
+
+# Not in there
+test_out("not ok 1 - Any peanut butter in my chocolate?");
+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));
+lacks_string("Reese's Peanut Butter Cups", "Peanut Butter", "Any peanut butter in my chocolate?");
+test_test("Not lacking");
+
+# Source string undef
+test_out("not ok 1 - Look inside undef");
+test_fail(2);
+test_diag(qq(String to look in is undef));
+lacks_string(undef,"Orange everything", "Look inside undef");
+test_test("Source string undef fails");
+
+# Searching string undef
+test_out("not ok 1 - Look for undef");
+test_fail(2);
+test_diag(qq(String to look for is undef));
+lacks_string('"Fishnet" is not a color', undef, "Look for undef");
+test_test("Substring undef fails");

Added: packages/libtest-longstring-perl/branches/upstream/current/t/pod-coverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtest-longstring-perl/branches/upstream/current/t/pod-coverage.t?rev=2636&op=file
==============================================================================
--- packages/libtest-longstring-perl/branches/upstream/current/t/pod-coverage.t (added)
+++ packages/libtest-longstring-perl/branches/upstream/current/t/pod-coverage.t Tue Apr 25 14:20:32 2006
@@ -1,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
+all_pod_coverage_ok();

Added: packages/libtest-longstring-perl/branches/upstream/current/t/pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtest-longstring-perl/branches/upstream/current/t/pod.t?rev=2636&op=file
==============================================================================
--- packages/libtest-longstring-perl/branches/upstream/current/t/pod.t (added)
+++ packages/libtest-longstring-perl/branches/upstream/current/t/pod.t Tue Apr 25 14:20:32 2006
@@ -1,0 +1,4 @@
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();




More information about the Pkg-perl-cvs-commits mailing list