Update of /cvsroot/module-build/Module-Build/t
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10357/t
Modified Files:
basic.t
Added Files:
ext.t
Log Message:
integrate split_like_shell() changes from bugfix branch
Index: basic.t
===================================================================
RCS file: /cvsroot/module-build/Module-Build/t/basic.t,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** basic.t 14 Nov 2004 11:30:55 -0000 1.31
--- basic.t 15 Nov 2004 02:56:28 -0000 1.32
***************
*** 3,7 ****
use strict;
use Test;
! BEGIN { plan tests => 49 }
use Module::Build;
ok(1);
--- 3,7 ----
use strict;
use Test;
! BEGIN { plan tests => 37 }
use Module::Build;
ok(1);
***************
*** 155,182 ****
ok $build->dist_author->[0], 'Foo Meister <fo...@ex...>';
}
-
- # Test shell emulation stuff
- {
- my @words = Module::Build->split_like_shell(q{one t'wo th'ree f"o\"ur " "five" });
- ok @words, 4;
- ok $words[0], 'one';
- ok $words[1], 'two three';
- ok $words[2], 'fo"ur ';
- ok $words[3], 'five';
-
- # Test whitespace handling
- @words = Module::Build->split_like_shell(q{ foo bar });
- ok @words, 2;
- ok $words[0], 'foo';
- ok $words[1], 'bar';
-
- # Test some Win32-specific stuff
- my $win = 'Module::Build::Platform::Windows';
- eval "use $win; 1" or die $@;
-
- @words = $win->split_like_shell(q{foo "\bar\baz" "b\"nai"});
- ok @words, 3;
- ok $words[0], 'foo';
- ok $words[1], '\bar\baz';
- ok $words[2], 'b"nai';
- }
--- 155,156 ----
--- NEW FILE: ext.t ---
use strict;
use Test;
my @unix_splits =
(
{ q{one t'wo th'ree f"o\"ur " "five" } => [ 'one', 'two three', 'fo"ur ', 'five' ] },
{ q{ foo bar } => [ 'foo', 'bar' ] },
);
my @win_splits =
(
{ 'a" "b\\c" "d' => [ 'a b\c d' ] },
{ '"a b\\c d"' => [ 'a b\c d' ] },
{ '"a b"\\"c d"' => [ 'a b"c', 'd' ] },
{ '"a b"\\\\"c d"' => [ 'a b\c d' ] },
{ '"a"\\"b" "a\\"b"' => [ 'a"b a"b' ] },
{ '"a"\\\\"b" "a\\\\"b"' => [ 'a\b', 'a\b' ] },
{ '"a"\\"b a\\"b"' => [ 'a"b', 'a"b' ] },
{ 'a"\\"b" "a\\"b' => [ 'a"b', 'a"b' ] },
{ 'a"\\"b" "a\\"b' => [ 'a"b', 'a"b' ] },
{ 'a b' => [ 'a', 'b' ] },
{ 'a"\\"b a\\"b' => [ 'a"b a"b' ] },
{ '"a""b" "a"b"' => [ 'a"b ab' ] },
{ '\\"a\\"' => [ '"a"' ] },
{ '"a"" "b"' => [ 'a"', 'b' ] },
{ 'a"b' => [ 'ab' ] },
{ 'a""b' => [ 'ab' ] },
{ 'a"""b' => [ 'a"b' ] },
{ 'a""""b' => [ 'a"b' ] },
{ 'a"""""b' => [ 'a"b' ] },
{ 'a""""""b' => [ 'a""b' ] },
{ '"a"b"' => [ 'ab' ] },
{ '"a""b"' => [ 'a"b' ] },
{ '"a"""b"' => [ 'a"b' ] },
{ '"a""""b"' => [ 'a"b' ] },
{ '"a"""""b"' => [ 'a""b' ] },
{ '"a""""""b"' => [ 'a""b' ] },
{ '' => [ ] },
{ ' ' => [ ] },
{ '""' => [ '' ] },
{ '" "' => [ ' ' ] },
{ '""a' => [ 'a' ] },
{ '""a b' => [ 'a', 'b' ] },
{ 'a""' => [ 'a' ] },
{ 'a"" b' => [ 'a', 'b' ] },
{ '"" a' => [ '', 'a' ] },
{ 'a ""' => [ 'a', '' ] },
{ 'a "" b' => [ 'a', '', 'b' ] },
{ 'a " " b' => [ 'a', ' ', 'b' ] },
{ 'a " b " c' => [ 'a', ' b ', 'c' ] },
);
plan tests => 1 + 2*@unix_splits + 2*@win_splits;
use Module::Build;
ok(1);
use Module::Build::Platform::Unix;
foreach my $test (@unix_splits) {
do_split_tests('Module::Build::Platform::Unix', $test);
}
use Module::Build::Platform::Windows;
foreach my $test (@win_splits) {
do_split_tests('Module::Build::Platform::Windows', $test);
}
sub do_split_tests {
my ($package, $test) = @_;
my ($string, $expected) = %$test;
my @result = $package->split_like_shell($string);
ok( grep( {!defined()} @result ), # all defined
0,
"'$string' result all defined" );
ok( join(' ', map "{$_}", @result),
join(' ', map "{$_}", @$expected),
join(' ', map "{$_}", @$expected) );
}
|