diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2013-06-21 22:29:11 +0100 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2013-06-21 22:57:25 +0100 |
commit | 33954ec3715c20be7a93d4b1b35e41cd32973e8e (patch) | |
tree | 1356e2e9a0e78ec7721b38e313af76973ea5bdf5 /cpan/Text-ParseWords | |
parent | 8b21fa03ebc1de8cb1217ea4e0458a42b4510b2c (diff) | |
download | perl-33954ec3715c20be7a93d4b1b35e41cd32973e8e.tar.gz |
Update Text-ParseWords to CPAN version 3.29
[DELTA]
3.29
Remove pod test from distribution
Diffstat (limited to 'cpan/Text-ParseWords')
-rw-r--r-- | cpan/Text-ParseWords/lib/Text/ParseWords.pm | 2 | ||||
-rw-r--r-- | cpan/Text-ParseWords/t/ParseWords.t | 244 | ||||
-rw-r--r-- | cpan/Text-ParseWords/t/taint.t | 11 |
3 files changed, 134 insertions, 123 deletions
diff --git a/cpan/Text-ParseWords/lib/Text/ParseWords.pm b/cpan/Text-ParseWords/lib/Text/ParseWords.pm index e8de4b6ab3..8771d43647 100644 --- a/cpan/Text-ParseWords/lib/Text/ParseWords.pm +++ b/cpan/Text-ParseWords/lib/Text/ParseWords.pm @@ -2,7 +2,7 @@ package Text::ParseWords; use strict; require 5.006; -our $VERSION = "3.28"; +our $VERSION = "3.29"; use Exporter; diff --git a/cpan/Text-ParseWords/t/ParseWords.t b/cpan/Text-ParseWords/t/ParseWords.t index 905ea00864..3fb7ac67b2 100644 --- a/cpan/Text-ParseWords/t/ParseWords.t +++ b/cpan/Text-ParseWords/t/ParseWords.t @@ -1,122 +1,122 @@ -#!./perl
-
-use warnings;
-use Text::ParseWords;
-use Test::More tests => 27;
-
-@words = shellwords(qq(foo "bar quiz" zoo));
-is($words[0], 'foo');
-is($words[1], 'bar quiz');
-is($words[2], 'zoo');
-
-{
- # Gonna get some undefined things back
- no warnings 'uninitialized' ;
-
- # Test quotewords() with other parameters and null last field
- @words = quotewords(':+', 1, 'foo:::"bar:foo":zoo zoo:');
- is(join(";", @words), qq(foo;"bar:foo";zoo zoo;));
-}
-
-# Test $keep eq 'delimiters' and last field zero
-@words = quotewords('\s+', 'delimiters', '4 3 2 1 0');
-is(join(";", @words), qq(4; ;3; ;2; ;1; ;0));
-
-# Big ol' nasty test (thanks, Joerk!)
-$string = 'aaaa"bbbbb" cc\\ cc \\\\\\"dddd" eee\\\\\\"ffff" "gg"';
-
-# First with $keep == 1
-$result = join('|', parse_line('\s+', 1, $string));
-is($result, 'aaaa"bbbbb"|cc\\ cc|\\\\\\"dddd" eee\\\\\\"ffff"|"gg"');
-
-# Now, $keep == 0
-$result = join('|', parse_line('\s+', 0, $string));
-is($result, 'aaaabbbbb|cc cc|\\"dddd eee\\"ffff|gg');
-
-# Now test single quote behavior
-$string = 'aaaa"bbbbb" cc\\ cc \\\\\\"dddd\' eee\\\\\\"ffff\' gg';
-$result = join('|', parse_line('\s+', 0, $string));
-is($result, 'aaaabbbbb|cc cc|\\"dddd eee\\\\\\"ffff|gg');
-
-# Make sure @nested_quotewords does the right thing
-@lists = nested_quotewords('\s+', 0, 'a b c', '1 2 3', 'x y z');
-is (@lists, 3);
-is (@{$lists[0]}, 3);
-is (@{$lists[1]}, 3);
-is (@{$lists[2]}, 3);
-
-# Now test error return
-$string = 'foo bar baz"bach blech boop';
-
-@words = shellwords($string);
-is(@words, 0);
-
-@words = parse_line('s+', 0, $string);
-is(@words, 0);
-
-@words = quotewords('s+', 0, $string);
-is(@words, 0);
-
-{
- # Gonna get some more undefined things back
- no warnings 'uninitialized' ;
-
- @words = nested_quotewords('s+', 0, $string);
- is(@words, 0);
-
- # Now test empty fields
- $result = join('|', parse_line(':', 0, 'foo::0:"":::'));
- is($result, 'foo||0||||');
-
- # Test for 0 in quotes without $keep
- $result = join('|', parse_line(':', 0, ':"0":'));
- is($result, '|0|');
-
- # Test for \001 in quoted string
- $result = join('|', parse_line(':', 0, ':"' . "\001" . '":'));
- is($result, "|\1|");
-
-}
-
-# Now test perlish single quote behavior
-$Text::ParseWords::PERL_SINGLE_QUOTE = 1;
-$string = 'aaaa"bbbbb" cc\ cc \\\\\"dddd\' eee\\\\\"\\\'ffff\' gg';
-$result = join('|', parse_line('\s+', 0, $string));
-is($result, 'aaaabbbbb|cc cc|\"dddd eee\\\\"\'ffff|gg');
-
-# test whitespace in the delimiters
-@words = quotewords(' ', 1, '4 3 2 1 0');
-is(join(";", @words), qq(4;3;2;1;0));
-
-# [perl #30442] Text::ParseWords does not handle backslashed newline inside quoted text
-$string = qq{"field1" "field2\\\nstill field2" "field3"};
-
-$result = join('|', parse_line("\t", 1, $string));
-is($result, qq{"field1"|"field2\\\nstill field2"|"field3"});
-
-$result = join('|', parse_line("\t", 0, $string));
-is($result, "field1|field2\nstill field2|field3");
-
-SKIP: { # unicode
- skip "No unicode",1 if $]<5.008;
- $string = qq{"field1"\x{1234}"field2\\\x{1234}still field2"\x{1234}"field3"};
- $result = join('|', parse_line("\x{1234}", 0, $string));
- is($result, "field1|field2\x{1234}still field2|field3",'Unicode');
-}
-
-# missing quote after matching regex used to hang after change #22997
-"1234" =~ /(1)(2)(3)(4)/;
-$string = qq{"missing quote};
-$result = join('|', shellwords($string));
-is($result, "");
-
-# make sure shellwords strips out leading whitespace and trailng undefs
-# from parse_line, so it's behavior is more like /bin/sh
-$result = join('|', shellwords(" aa \\ \\ bb ", " \\ ", "cc dd ee\\ "));
-is($result, "aa| | bb| |cc|dd|ee ");
-
-$SIG{ALRM} = sub {die "Timeout!"};
-alarm(3);
-@words = Text::ParseWords::old_shellwords("foo\\");
-is(@words, 1);
-alarm(0);
+#!./perl + +use warnings; +use Text::ParseWords; +use Test::More tests => 27; + +@words = shellwords(qq(foo "bar quiz" zoo)); +is($words[0], 'foo'); +is($words[1], 'bar quiz'); +is($words[2], 'zoo'); + +{ + # Gonna get some undefined things back + no warnings 'uninitialized' ; + + # Test quotewords() with other parameters and null last field + @words = quotewords(':+', 1, 'foo:::"bar:foo":zoo zoo:'); + is(join(";", @words), qq(foo;"bar:foo";zoo zoo;)); +} + +# Test $keep eq 'delimiters' and last field zero +@words = quotewords('\s+', 'delimiters', '4 3 2 1 0'); +is(join(";", @words), qq(4; ;3; ;2; ;1; ;0)); + +# Big ol' nasty test (thanks, Joerk!) +$string = 'aaaa"bbbbb" cc\\ cc \\\\\\"dddd" eee\\\\\\"ffff" "gg"'; + +# First with $keep == 1 +$result = join('|', parse_line('\s+', 1, $string)); +is($result, 'aaaa"bbbbb"|cc\\ cc|\\\\\\"dddd" eee\\\\\\"ffff"|"gg"'); + +# Now, $keep == 0 +$result = join('|', parse_line('\s+', 0, $string)); +is($result, 'aaaabbbbb|cc cc|\\"dddd eee\\"ffff|gg'); + +# Now test single quote behavior +$string = 'aaaa"bbbbb" cc\\ cc \\\\\\"dddd\' eee\\\\\\"ffff\' gg'; +$result = join('|', parse_line('\s+', 0, $string)); +is($result, 'aaaabbbbb|cc cc|\\"dddd eee\\\\\\"ffff|gg'); + +# Make sure @nested_quotewords does the right thing +@lists = nested_quotewords('\s+', 0, 'a b c', '1 2 3', 'x y z'); +is (@lists, 3); +is (@{$lists[0]}, 3); +is (@{$lists[1]}, 3); +is (@{$lists[2]}, 3); + +# Now test error return +$string = 'foo bar baz"bach blech boop'; + +@words = shellwords($string); +is(@words, 0); + +@words = parse_line('s+', 0, $string); +is(@words, 0); + +@words = quotewords('s+', 0, $string); +is(@words, 0); + +{ + # Gonna get some more undefined things back + no warnings 'uninitialized' ; + + @words = nested_quotewords('s+', 0, $string); + is(@words, 0); + + # Now test empty fields + $result = join('|', parse_line(':', 0, 'foo::0:"":::')); + is($result, 'foo||0||||'); + + # Test for 0 in quotes without $keep + $result = join('|', parse_line(':', 0, ':"0":')); + is($result, '|0|'); + + # Test for \001 in quoted string + $result = join('|', parse_line(':', 0, ':"' . "\001" . '":')); + is($result, "|\1|"); + +} + +# Now test perlish single quote behavior +$Text::ParseWords::PERL_SINGLE_QUOTE = 1; +$string = 'aaaa"bbbbb" cc\ cc \\\\\"dddd\' eee\\\\\"\\\'ffff\' gg'; +$result = join('|', parse_line('\s+', 0, $string)); +is($result, 'aaaabbbbb|cc cc|\"dddd eee\\\\"\'ffff|gg'); + +# test whitespace in the delimiters +@words = quotewords(' ', 1, '4 3 2 1 0'); +is(join(";", @words), qq(4;3;2;1;0)); + +# [perl #30442] Text::ParseWords does not handle backslashed newline inside quoted text +$string = qq{"field1" "field2\\\nstill field2" "field3"}; + +$result = join('|', parse_line("\t", 1, $string)); +is($result, qq{"field1"|"field2\\\nstill field2"|"field3"}); + +$result = join('|', parse_line("\t", 0, $string)); +is($result, "field1|field2\nstill field2|field3"); + +SKIP: { # unicode + skip "No unicode",1 if $]<5.008; + $string = qq{"field1"\x{1234}"field2\\\x{1234}still field2"\x{1234}"field3"}; + $result = join('|', parse_line("\x{1234}", 0, $string)); + is($result, "field1|field2\x{1234}still field2|field3",'Unicode'); +} + +# missing quote after matching regex used to hang after change #22997 +"1234" =~ /(1)(2)(3)(4)/; +$string = qq{"missing quote}; +$result = join('|', shellwords($string)); +is($result, ""); + +# make sure shellwords strips out leading whitespace and trailng undefs +# from parse_line, so it's behavior is more like /bin/sh +$result = join('|', shellwords(" aa \\ \\ bb ", " \\ ", "cc dd ee\\ ")); +is($result, "aa| | bb| |cc|dd|ee "); + +$SIG{ALRM} = sub {die "Timeout!"}; +alarm(3); +@words = Text::ParseWords::old_shellwords("foo\\"); +is(@words, 1); +alarm(0); diff --git a/cpan/Text-ParseWords/t/taint.t b/cpan/Text-ParseWords/t/taint.t index 959ba79700..0841aaf6c7 100644 --- a/cpan/Text-ParseWords/t/taint.t +++ b/cpan/Text-ParseWords/t/taint.t @@ -1,6 +1,17 @@ #!./perl -Tw # [perl #33173] shellwords.pl and tainting +BEGIN { + if ( $ENV{PERL_CORE} ) { + require Config; + no warnings 'once'; + if ($Config::Config{extensions} !~ /\bList\/Util\b/) { + print "1..0 # Skip: Scalar::Util was not built\n"; + exit 0; + } + } +} + use Text::ParseWords qw(shellwords old_shellwords); use Scalar::Util qw(tainted); |