r58725 - in /branches/upstream/libtext-trim-perl: ./ current/ current/lib/ current/lib/Text/ current/t/

mzagrabe-guest at users.alioth.debian.org mzagrabe-guest at users.alioth.debian.org
Tue Jun 1 19:56:57 UTC 2010


Author: mzagrabe-guest
Date: Tue Jun  1 19:54:53 2010
New Revision: 58725

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

Added:
    branches/upstream/libtext-trim-perl/
    branches/upstream/libtext-trim-perl/current/
    branches/upstream/libtext-trim-perl/current/Build.PL
    branches/upstream/libtext-trim-perl/current/Changes
    branches/upstream/libtext-trim-perl/current/MANIFEST
    branches/upstream/libtext-trim-perl/current/META.yml
    branches/upstream/libtext-trim-perl/current/Makefile.PL
    branches/upstream/libtext-trim-perl/current/README
    branches/upstream/libtext-trim-perl/current/lib/
    branches/upstream/libtext-trim-perl/current/lib/Text/
    branches/upstream/libtext-trim-perl/current/lib/Text/Trim.pm
    branches/upstream/libtext-trim-perl/current/t/
    branches/upstream/libtext-trim-perl/current/t/01..trim.t
    branches/upstream/libtext-trim-perl/current/t/02..ltrim.t
    branches/upstream/libtext-trim-perl/current/t/03..rtrim.t
    branches/upstream/libtext-trim-perl/current/t/04..unicode.t
    branches/upstream/libtext-trim-perl/current/t/05..undef.t
    branches/upstream/libtext-trim-perl/current/t/99..pod.t

Added: branches/upstream/libtext-trim-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-trim-perl/current/Build.PL?rev=58725&op=file
==============================================================================
--- branches/upstream/libtext-trim-perl/current/Build.PL (added)
+++ branches/upstream/libtext-trim-perl/current/Build.PL Tue Jun  1 19:54:53 2010
@@ -1,0 +1,17 @@
+use strict;
+use warnings;
+
+use Module::Build;
+
+Module::Build->new(
+        module_name => 'Text::Trim',
+        requires => {
+            perl => '5',
+        },
+        build_requires => {
+            'Test::More' => 0,
+        },
+        license => 'perl',
+        create_makefile_pl => 'passthrough',
+        create_readme => 1,
+    )->create_build_script;

Added: branches/upstream/libtext-trim-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-trim-perl/current/Changes?rev=58725&op=file
==============================================================================
--- branches/upstream/libtext-trim-perl/current/Changes (added)
+++ branches/upstream/libtext-trim-perl/current/Changes Tue Jun  1 19:54:53 2010
@@ -1,0 +1,8 @@
+
+1.01    Mon Feb 27 2006
+        - Added reference to String::Strip in docs
+        - Added docs and tests demonstrating unicode support
+
+1.00	Wed Feb 22 2006
+	- Initial version
+    

Added: branches/upstream/libtext-trim-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-trim-perl/current/MANIFEST?rev=58725&op=file
==============================================================================
--- branches/upstream/libtext-trim-perl/current/MANIFEST (added)
+++ branches/upstream/libtext-trim-perl/current/MANIFEST Tue Jun  1 19:54:53 2010
@@ -1,0 +1,13 @@
+Build.PL
+Changes
+lib/Text/Trim.pm
+Makefile.PL
+MANIFEST			This list of files
+META.yml
+README
+t/01..trim.t
+t/02..ltrim.t
+t/03..rtrim.t
+t/04..unicode.t
+t/05..undef.t
+t/99..pod.t

Added: branches/upstream/libtext-trim-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-trim-perl/current/META.yml?rev=58725&op=file
==============================================================================
--- branches/upstream/libtext-trim-perl/current/META.yml (added)
+++ branches/upstream/libtext-trim-perl/current/META.yml Tue Jun  1 19:54:53 2010
@@ -1,0 +1,21 @@
+---
+name: Text-Trim
+version: 1.02
+author:
+  - 'Matt Lawrence E<lt>mattlaw at cpan.orgE<gt>'
+abstract: remove leading and/or trailing whitespace from strings
+license: perl
+resources:
+  license: http://dev.perl.org/licenses/
+requires:
+  perl: 5
+build_requires:
+  Test::More: 0
+provides:
+  Text::Trim:
+    file: lib/Text/Trim.pm
+    version: 1.02
+generated_by: Module::Build version 0.33
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4

Added: branches/upstream/libtext-trim-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-trim-perl/current/Makefile.PL?rev=58725&op=file
==============================================================================
--- branches/upstream/libtext-trim-perl/current/Makefile.PL (added)
+++ branches/upstream/libtext-trim-perl/current/Makefile.PL Tue Jun  1 19:54:53 2010
@@ -1,0 +1,35 @@
+# Note: this file was auto-generated by Module::Build::Compat version 0.33
+require 5;
+    
+    unless (eval "use Module::Build::Compat 0.02; 1" ) {
+      print "This module requires Module::Build to install itself.\n";
+      
+      require ExtUtils::MakeMaker;
+      my $yn = ExtUtils::MakeMaker::prompt
+	('  Install Module::Build now from CPAN?', 'y');
+      
+      unless ($yn =~ /^y/i) {
+	die " *** Cannot install without Module::Build.  Exiting ...\n";
+      }
+      
+      require Cwd;
+      require File::Spec;
+      require CPAN;
+      
+      # Save this 'cause CPAN will chdir all over the place.
+      my $cwd = Cwd::cwd();
+      
+      CPAN::Shell->install('Module::Build::Compat');
+      CPAN::Shell->expand("Module", "Module::Build::Compat")->uptodate
+	or die "Couldn't install Module::Build, giving up.\n";
+      
+      chdir $cwd or die "Cannot chdir() back to $cwd: $!";
+    }
+    eval "use Module::Build::Compat 0.02; 1" or die $@;
+    
+    Module::Build::Compat->run_build_pl(args => \@ARGV);
+    my $build_script = 'Build';  
+    $build_script .= '.com' if $^O eq 'VMS';
+    exit(0) unless(-e $build_script); # cpantesters convention
+    require Module::Build;
+    Module::Build::Compat->write_makefile(build_class => 'Module::Build');

Added: branches/upstream/libtext-trim-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-trim-perl/current/README?rev=58725&op=file
==============================================================================
--- branches/upstream/libtext-trim-perl/current/README (added)
+++ branches/upstream/libtext-trim-perl/current/README Tue Jun  1 19:54:53 2010
@@ -1,0 +1,119 @@
+NAME
+    Text::Trim - remove leading and/or trailing whitespace from strings
+
+VERSION
+    version 1.02
+
+SYNOPSIS
+        use Text::Trim;
+
+        $text = "\timportant data\n";
+        $data = trim $text;
+        # now $data contains "important data" and $text is unchanged
+        
+    # or:
+        trim $text; # work in-place, $text now contains "important data"
+
+        @lines = <STDIN>;
+        rtrim @lines; # remove trailing whitespace from all lines
+
+        # Alternatively:
+        @lines = rtrim <STDIN>;
+
+        # Or even:
+        while (<STDIN>) {
+            trim; # Change $_ in place
+            # ...
+        }
+
+DESCRIPTION
+    This module provides functions for removing leading and/or trailing
+    whitespace from strings. It is basically a wrapper around some simple
+    regexes with a flexible context-based interface.
+
+EXPORTS
+    All functions are exported by default.
+
+CONTEXT HANDLING
+  void context
+    Functions called in void context change their arguments in-place
+
+        trim(@strings); # All strings in @strings are trimmed in-place
+
+        ltrim($text); # remove leading whitespace on $text
+
+        rtrim; # remove trailing whitespace on $_
+
+    No changes are made to arguments in non-void contexts.
+
+  list context
+    Values passed in are changed and returned without affecting the
+    originals.
+
+        @result = trim(@strings); # @strings is unchanged
+
+        @result = rtrim; # @result contains rtrimmed $_
+
+        ($result) = ltrim(@strings); # like $result = ltrim($strings[0]);
+
+  scalar context
+    As list context but multiple arguments are stringified before being
+    returned. Single arguments are unaffected. This means that under these
+    circumstances, the value of $" ($LIST_SEPARATOR) is used to join the
+    values. If you don't want this, make sure you only use single arguments
+    when calling in scalar context.
+
+        @strings = ("\thello\n", "\tthere\n");
+        $trimmed = trim(@strings);
+        # $trimmed = "hello there"
+
+        local $" = ', ';
+        $trimmed = trim(@strings);
+        # Now $trimmed = "hello, there"
+
+        $trimmed = rtrim;
+        # $trimmed = $_ minus trailing whitespace
+
+  Undefined values
+    If any of the functions are called with undefined values, the behaviour
+    is in general to pass them through unchanged. When stringifying a list
+    (calling in scalar context with multiple arguments) undefined elements
+    are excluded, but if all elements are undefined then the return value is
+    also undefined.
+
+        $foo = trim(undef);        # $foo is undefined
+        $foo = trim(undef, undef); # $foo is undefined
+        @foo = trim(undef, undef); # @foo contains 2 undefined values
+        trim(@foo)                 # @foo still contains 2 undefined values
+        $foo = trim('', undef);    # $foo is ''
+
+FUNCTIONS
+  trim
+    Removes leading and trailing whitespace from all arguments, or $_ if
+    none are provided.
+
+  rtrim
+    Like trim() but removes only trailing (right) whitespace.
+
+  ltrim
+    Like trim() but removes only leading (left) whitespace.
+
+UNICODE
+    Because this module is implemented using perl regular expressions, it is
+    capable of recognising and removing unicode whitespace characters (such
+    as non-breaking spaces) from scalars with the utf8 flag on. See Encode
+    for details about the utf8 flag.
+
+    Note that this only applies in the case of perl versions after 5.8.0 or
+    so.
+
+SEE ALSO
+    Brent B. Powers' String::Strip performs a similar function in XS.
+
+AUTHOR
+    Matt Lawrence <mattlaw at cpan.org>
+
+ACKNOWLEDGEMENTS
+    Terrence Brannon <metaperl at gmail.com> for bringing my attention to
+    String::Strip and suggesting documentation changes.
+

Added: branches/upstream/libtext-trim-perl/current/lib/Text/Trim.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-trim-perl/current/lib/Text/Trim.pm?rev=58725&op=file
==============================================================================
--- branches/upstream/libtext-trim-perl/current/lib/Text/Trim.pm (added)
+++ branches/upstream/libtext-trim-perl/current/lib/Text/Trim.pm Tue Jun  1 19:54:53 2010
@@ -1,0 +1,192 @@
+package Text::Trim;
+
+use strict;
+use warnings;
+
+=head1 NAME
+
+Text::Trim - remove leading and/or trailing whitespace from strings
+
+=head1 VERSION
+
+version 1.02
+
+=cut
+
+our $VERSION = '1.02';
+
+=head1 SYNOPSIS
+
+    use Text::Trim;
+
+    $text = "\timportant data\n";
+    $data = trim $text;
+    # now $data contains "important data" and $text is unchanged
+    
+    # or:
+    trim $text; # work in-place, $text now contains "important data"
+
+    @lines = <STDIN>;
+    rtrim @lines; # remove trailing whitespace from all lines
+
+    # Alternatively:
+    @lines = rtrim <STDIN>;
+
+    # Or even:
+    while (<STDIN>) {
+        trim; # Change $_ in place
+        # ...
+    }
+
+=head1 DESCRIPTION
+
+This module provides functions for removing leading and/or trailing whitespace
+from strings. It is basically a wrapper around some simple regexes with a
+flexible context-based interface.
+
+=head1 EXPORTS
+
+All functions are exported by default.
+
+=cut
+
+use Exporter;
+
+our @ISA = qw( Exporter );
+our @EXPORT = qw( rtrim ltrim trim );
+
+=head1 CONTEXT HANDLING
+
+=head2 void context
+
+Functions called in void context change their arguments in-place
+
+    trim(@strings); # All strings in @strings are trimmed in-place
+
+    ltrim($text); # remove leading whitespace on $text
+
+    rtrim; # remove trailing whitespace on $_
+
+No changes are made to arguments in non-void contexts.
+
+=head2 list context
+
+Values passed in are changed and returned without affecting the originals.
+
+    @result = trim(@strings); # @strings is unchanged
+
+    @result = rtrim; # @result contains rtrimmed $_
+
+    ($result) = ltrim(@strings); # like $result = ltrim($strings[0]);
+
+=head2 scalar context
+
+As list context but multiple arguments are stringified before being returned.
+Single arguments are unaffected.  This means that under these circumstances, the
+value of $" ($LIST_SEPARATOR) is used to join the values. If you don't want
+this, make sure you only use single arguments when calling in scalar context.
+
+    @strings = ("\thello\n", "\tthere\n");
+    $trimmed = trim(@strings);
+    # $trimmed = "hello there"
+
+    local $" = ', ';
+    $trimmed = trim(@strings);
+    # Now $trimmed = "hello, there"
+
+    $trimmed = rtrim;
+    # $trimmed = $_ minus trailing whitespace
+
+=head2 Undefined values
+
+If any of the functions are called with undefined values, the behaviour is in
+general to pass them through unchanged. When stringifying a list (calling in
+scalar context with multiple arguments) undefined elements are excluded, but
+if all elements are undefined then the return value is also undefined.
+
+    $foo = trim(undef);        # $foo is undefined
+    $foo = trim(undef, undef); # $foo is undefined
+    @foo = trim(undef, undef); # @foo contains 2 undefined values
+    trim(@foo)                 # @foo still contains 2 undefined values
+    $foo = trim('', undef);    # $foo is ''
+
+=head1 FUNCTIONS
+
+=head2 trim
+
+Removes leading and trailing whitespace from all arguments, or $_ if none are
+provided.
+
+=cut
+
+sub trim {
+    @_ = @_ ? @_ : $_ if defined wantarray;
+
+    for (@_ ? @_ : $_) { next unless defined; s/\A\s+//; s/\s+\z// }
+
+    return @_ if wantarray || !defined wantarray;
+
+    if (my @def = grep defined, @_) { return "@def" } else { return }
+}
+
+=head2 rtrim 
+
+Like trim() but removes only trailing (right) whitespace.
+
+=cut
+
+sub rtrim {
+    @_ = @_ ? @_ : $_ if defined wantarray;
+
+    for (@_ ? @_ : $_) { next unless defined; s/\s+\z// }
+
+    return @_ if wantarray || !defined wantarray;
+
+    if (my @def = grep defined, @_) { return "@def" } else { return }
+}
+
+=head2 ltrim
+
+Like trim() but removes only leading (left) whitespace.
+
+=cut
+
+sub ltrim {
+    @_ = @_ ? @_ : $_ if defined wantarray;
+
+    for (@_ ? @_ : $_) { next unless defined; s/\A\s+// }
+
+    return @_ if wantarray || !defined wantarray;
+
+    if (my @def = grep defined, @_) { return "@def" } else { return }
+}
+
+1;
+
+__END__
+
+=head1 UNICODE
+
+Because this module is implemented using perl regular expressions, it is capable
+of recognising and removing unicode whitespace characters (such as non-breaking
+spaces) from scalars with the utf8 flag on. See L<Encode> for details about the
+utf8 flag.
+
+Note that this only applies in the case of perl versions after 5.8.0 or so.
+
+=head1 SEE ALSO
+
+Brent B. Powers' L<String::Strip> performs a similar function in XS.
+
+=head1 AUTHOR
+
+Matt Lawrence E<lt>mattlaw at cpan.orgE<gt>
+
+=head1 ACKNOWLEDGEMENTS
+
+Terrence Brannon E<lt>metaperl at gmail.comE<gt> for bringing my attention to
+L<String::Strip> and suggesting documentation changes.
+
+=cut
+
+vim: ts=8 sts=4 sw=4 sr et

Added: branches/upstream/libtext-trim-perl/current/t/01..trim.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-trim-perl/current/t/01..trim.t?rev=58725&op=file
==============================================================================
--- branches/upstream/libtext-trim-perl/current/t/01..trim.t (added)
+++ branches/upstream/libtext-trim-perl/current/t/01..trim.t Tue Jun  1 19:54:53 2010
@@ -1,0 +1,44 @@
+use strict;
+use warnings;
+
+use Test::More tests => 10;
+
+BEGIN {
+    use_ok('Text::Trim');
+}
+
+my $text = my $orig = "\t  foo\t  \t\n";
+is(trim($text), 'foo', 'trim in scalar context');
+is($text, $orig, ".. didn't affect original");
+
+trim($text);
+is($text, 'foo', 'trim in place changes original');
+
+{
+    local $_ = $orig;
+    my $trimmed = trim;
+    is($trimmed, 'foo', '$scalar = trim() works on $_');
+    is($_,     , $orig, ".. didn't affect original");
+
+    trim;
+    is($_,     , 'foo', "trim() alters \$_")
+}
+
+my @before = (
+    "  foo  ",
+    "\tbar\t",
+    "\nbaz\n",
+);
+my @expected = qw( foo bar baz );
+my @trimmed = trim @before;
+is_deeply(\@trimmed, \@expected, 'trim on a list in list content');
+trim @before;
+is_deeply(\@before, \@expected,  'trim on a list in place');
+
+my $expected = "@expected";
+my $trimmed = trim @before;
+is($trimmed, $expected, 'trim on a list in scalar context');
+
+__END__
+
+vim: ft=perl ts=8 sts=4 sw=4 sr et

Added: branches/upstream/libtext-trim-perl/current/t/02..ltrim.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-trim-perl/current/t/02..ltrim.t?rev=58725&op=file
==============================================================================
--- branches/upstream/libtext-trim-perl/current/t/02..ltrim.t (added)
+++ branches/upstream/libtext-trim-perl/current/t/02..ltrim.t Tue Jun  1 19:54:53 2010
@@ -1,0 +1,45 @@
+use strict;
+use warnings;
+
+use Test::More tests => 10;
+
+BEGIN {
+    use_ok('Text::Trim');
+}
+
+my $text = my $orig = "\t  foo\t  \t\n";
+my $expected = "foo\t  \t\n";
+is(ltrim($text), $expected, 'ltrim in scalar context');
+is($text, $orig, ".. didn't affect original");
+
+ltrim($text);
+is($text, $expected, 'ltrim in place changes original');
+
+{
+    local $_ = $orig;
+    my $ltrimmed = ltrim;
+    is($ltrimmed, $expected, '$scalar = ltrim() works on $_');
+    is($_,     , $orig, ".. didn't affect original");
+
+    ltrim;
+    is($_,     , $expected, "ltrim() alters \$_")
+}
+
+my @before = (
+    "  foo  ",
+    "\tbar\t",
+    "\nbaz\n",
+);
+my @expected = ("foo  ", "bar\t", "baz\n");
+my @ltrimmed = ltrim @before;
+is_deeply(\@ltrimmed, \@expected, 'ltrim on a list in list content');
+ltrim @before;
+is_deeply(\@before, \@expected,  'ltrim on a list in place');
+
+$expected = "@expected";
+my $ltrimmed = ltrim @before;
+is($ltrimmed, $expected, 'ltrim on a list in scalar context');
+
+__END__
+
+vim: ft=perl ts=8 sts=4 sw=4 sr et

Added: branches/upstream/libtext-trim-perl/current/t/03..rtrim.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-trim-perl/current/t/03..rtrim.t?rev=58725&op=file
==============================================================================
--- branches/upstream/libtext-trim-perl/current/t/03..rtrim.t (added)
+++ branches/upstream/libtext-trim-perl/current/t/03..rtrim.t Tue Jun  1 19:54:53 2010
@@ -1,0 +1,45 @@
+use strict;
+use warnings;
+
+use Test::More tests => 10;
+
+BEGIN {
+    use_ok('Text::Trim');
+}
+
+my $text = my $orig = "\t  foo\t  \t\n";
+my $expected = "\t  foo";
+is(rtrim($text), $expected, 'rtrim in scalar context');
+is($text, $orig, ".. didn't affect original");
+
+rtrim($text);
+is($text, $expected, 'rtrim in place changes original');
+
+{
+    local $_ = $orig;
+    my $rtrimmed = rtrim;
+    is($rtrimmed, $expected, '$scalar = rtrim() works on $_');
+    is($_,     , $orig, ".. didn't affect original");
+
+    rtrim;
+    is($_,     , $expected, "rtrim() alters \$_")
+}
+
+my @before = (
+    "  foo  ",
+    "\tbar\t",
+    "\nbaz\n",
+);
+my @expected = ("  foo", "\tbar", "\nbaz");
+my @rtrimmed = rtrim @before;
+is_deeply(\@rtrimmed, \@expected, 'rtrim on a list in list content');
+rtrim @before;
+is_deeply(\@before, \@expected,  'rtrim on a list in place');
+
+$expected = "@expected";
+my $rtrimmed = rtrim @before;
+is($rtrimmed, $expected, 'rtrim on a list in scalar context');
+
+__END__
+
+vim: ft=perl ts=8 sts=4 sw=4 sr et

Added: branches/upstream/libtext-trim-perl/current/t/04..unicode.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-trim-perl/current/t/04..unicode.t?rev=58725&op=file
==============================================================================
--- branches/upstream/libtext-trim-perl/current/t/04..unicode.t (added)
+++ branches/upstream/libtext-trim-perl/current/t/04..unicode.t Tue Jun  1 19:54:53 2010
@@ -1,0 +1,30 @@
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+
+BEGIN { use_ok('Text::Trim') }
+
+SKIP: {
+    eval { require Encode };
+    if ($@) {
+        skip("Unicode tests require Encode.pm (core with 5.7.3 and later)", 3);
+    }
+    import Encode qw( decode :fallbacks );
+
+    # unicode non-breaking space;
+    my $nbsp = "\xc2\xa0";
+
+    my $text = my $orig = decode('UTF-8', "$nbsp$nbsp\tFoo Bar Baz$nbsp\t\r\n", FB_WARN());
+    my $expected = 'Foo Bar Baz';
+
+    is(trim($text), $expected, 'trim with unicode whitespace works');
+    is($text,       $orig,     'original string unaffected');
+    trim($text);
+    is($text,       $expected, 'works in void context too');
+}
+
+
+__END__
+
+vim: ft=perl ts=8 sts=4 sw=4 sr et

Added: branches/upstream/libtext-trim-perl/current/t/05..undef.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-trim-perl/current/t/05..undef.t?rev=58725&op=file
==============================================================================
--- branches/upstream/libtext-trim-perl/current/t/05..undef.t (added)
+++ branches/upstream/libtext-trim-perl/current/t/05..undef.t Tue Jun  1 19:54:53 2010
@@ -1,0 +1,66 @@
+use strict;
+use warnings;
+
+use Test::More tests => 27;
+
+use Text::Trim;
+
+local $SIG{__WARN__} = sub { push our @warnings, @_ };
+
+my %op = do { no strict 'refs'; map { $_ => \&{$_} } qw( trim ltrim rtrim ) };
+
+# Some data interspersed with undef
+my @list = ("   x  ", undef, " y", undef, "\tz\n");
+my %expect = (
+    ltrim => {
+        list => [ "x  ", undef, "y", undef, "z\n" ],
+        scalar => "x  :y:z\n",
+    },
+    rtrim => {
+        list => [ "   x", undef, " y", undef, "\tz" ],
+        scalar => "   x: y:\tz",
+    },
+    trim => {
+        list => [ "x", undef, "y", undef, "z" ],
+        scalar => "x:y:z",
+    }
+);
+
+for my $op (keys %op) {
+    my $trim = $op{$op};
+    my $expect = $expect{$op};
+
+    {
+        local our @warnings;
+        is $trim->(undef), undef, "scalar $op(undef)";
+        is @warnings, 0, '.. no warnings';
+    }
+
+    {
+        local our @warnings;
+        my $out = do { local $" = ':'; $trim->(@list) };
+        is $out, $expect->{scalar}, "$op list with undefs";
+        is @warnings, 0, '.. no warnings';
+    }
+
+    {
+        local our @warnings;
+        my @out = $trim->(@list);
+        is_deeply \@out, $expect->{list}, "$op list in list context";
+        is @warnings, 0, '.. no warnings';
+    }
+
+    {
+        local our @warnings;
+        $trim->(undef);
+        is @warnings, 0, "void $op(undef) produces no warnings"
+    }
+
+    {
+        local our @warnings;
+        my @copy = @list;
+        $trim->(@copy);
+        is_deeply \@copy, $expect->{list}, "void $op list";
+        is @warnings, 0, '.. no warnings';
+    }
+}

Added: branches/upstream/libtext-trim-perl/current/t/99..pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-trim-perl/current/t/99..pod.t?rev=58725&op=file
==============================================================================
--- branches/upstream/libtext-trim-perl/current/t/99..pod.t (added)
+++ branches/upstream/libtext-trim-perl/current/t/99..pod.t Tue Jun  1 19:54:53 2010
@@ -1,0 +1,41 @@
+
+BEGIN {
+    our @modules = qw(
+        Text::Trim
+    );
+}
+
+use File::Spec::Functions qw( catfile );
+
+use Test::More tests => our @modules * 2;
+
+SKIP: {
+    eval 'use Test::Pod';
+
+    skip "Test::Pod not installed", scalar @modules if $@;
+
+    for my $module (@modules) {
+        my @path = ('lib', split('::', $module));
+        my $file = pop(@path) . '.pm';
+        
+        pod_file_ok(catfile(@path, $file), "$module pod ok");
+    }
+}
+
+SKIP: {
+    eval 'use Test::Pod::Coverage';
+
+    skip "Test::Pod::Coverage not installed", scalar @modules if $@;
+
+    for my $module (@modules) {
+        pod_coverage_ok(
+            $module,
+            { also_private => [ qr(^[[:upper:][:digit:]_]+$) ] },
+            "$module pod coverage ok"
+        );
+    }
+}
+
+__END__
+
+vim: ft=perl ts=8 sts=4 sw=4 sr et




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