[Module-build-checkins] Module-Build/t basic.t,1.29,1.30 common.pl,1.9,1.10
Status: Beta
Brought to you by:
kwilliams
From: Randy W. S. <si...@us...> - 2004-11-13 09:30:57
|
Update of /cvsroot/module-build/Module-Build/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20706/t Modified Files: basic.t common.pl Log Message: Updated split_like_shell() on Win32 platform to behave more like the native shells (command.com and cmd.exe) with regards to quoting and escape characters. Index: common.pl =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/common.pl,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** common.pl 5 Sep 2004 19:50:15 -0000 1.9 --- common.pl 13 Nov 2004 09:30:48 -0000 1.10 *************** *** 64,66 **** --- 64,77 ---- } + sub array_eq { # like Test::More::eq_array + my( $a1, $a2 ) = @_; + return 0 unless @$a1 == @$a2; + + for my $i ( 0..$#{$a1} ) { + return 0 unless $a1->[$i] eq $a2->[$i]; + } + + return 1; + } + 1; Index: basic.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/basic.t,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** basic.t 14 Oct 2004 03:38:12 -0000 1.29 --- basic.t 13 Nov 2004 09:30:48 -0000 1.30 *************** *** 3,7 **** use strict; use Test; ! BEGIN { plan tests => 49 } use Module::Build; ok(1); --- 3,7 ---- use strict; use Test; ! BEGIN { plan tests => 85 } use Module::Build; ok(1); *************** *** 158,162 **** # 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'; --- 158,162 ---- # Test shell emulation stuff { ! my @words = Module::Build::Base->split_like_shell(q{one t'wo th'ree f"o\"ur " "five" }); ok @words, 4; ok $words[0], 'one'; *************** *** 174,182 **** 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'; } --- 174,226 ---- my $win = 'Module::Build::Platform::Windows'; eval "use $win; 1" or die $@; ! ! my @tests = ( ! { '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' ] }, ! { 'a "\\b\\c" "d\\"e"' => [ 'a', '\b\c', 'd"e' ] }, ! ); ! ! local $" = ', '; ! foreach my $test ( @tests ) { ! my( $string, $expected ) = %$test; ! my @result = $win->split_like_shell( $string ); ! ok array_eq( \@result, $expected ); ! } } |