# New Ticket Created by  Ron Blaschke 
# Please include the string:  [perl #39928]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=39928 >


Problem: languages/lazy-k/t/calc.t calls C<echo '1+2*3' | ../../parrot
lazy.pir calc.lazy>, and the single quotes are passed literally on
Windows, which seems unexpected by lazy-k, or at least causes additional
newlines.

>prove lazy-k/t/calc.t
lazy-k/t/calc....
#     Failed test (lazy-k/t/calc.t at line 40)
#          got: '
# 7
#
# '
#     expected: '7
# '
# Looks like you failed 1 test of 1.
lazy-k/t/calc....dubious
        Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 1
        Failed 1/1 tests, 0.00% okay
Failed Test     Stat Wstat Total Fail  Failed  List of Failed
-------------------------------------------------------------------------------
lazy-k/t/calc.t    1   256     1    1 100.00%  1
Failed 1/1 test scripts, 0.00% okay. 1/1 subtests failed, 0.00% okay.


Possible Solution: Probably not a very good solution, but it seems to
work.  Attached patch avoids the single quotes on Windows.

>prove lazy-k/t/calc.t
lazy-k/t/calc....ok
All tests successful.
Files=1, Tests=1,  2 wallclock secs ( 0.00 cusr +  0.00 csys =  0.00 CPU)


Changed Files:
    languages/lazy-k/t/calc.t

Index: languages/lazy-k/t/calc.t
===================================================================
--- languages/lazy-k/t/calc.t   (revision 13495)
+++ languages/lazy-k/t/calc.t   (working copy)
@@ -30,11 +30,21 @@
 use Parrot::Config;
 use File::Spec();
 
+my $is_win32  = $^O eq 'MSWin32';
+
 my $parrot    = File::Spec->catfile( File::Spec->updir(), $PConfig{test_prog} 
);
 my $lazy_k    = $parrot . q{ } . File::Spec->catfile( 'lazy-k', 'lazy.pir' );
 my $calc_lazy = File::Spec->catfile( 'lazy-k', 'calc.lazy' ); 
 
 # XXX This does not look portable.
-my $cmd = qq{echo '1+2*3' | $lazy_k $calc_lazy};
+my $cmd;
+if ($is_win32) {
+    # Don't quote the string on Windows, it is passed on literally
+    $cmd = qq{echo 1+2*3 | $lazy_k $calc_lazy};
+}
+else {
+    $cmd = qq{echo '1+2*3' | $lazy_k $calc_lazy};
+}
+
 # die Dumper( $cmd );
 is( `$cmd`, "7\n", 'calc.lazy' );

Reply via email to