Hi,

I'm building a new Moose package for Camelbox [1], using Moose
0.77/Class::MOP 0.83 on MSWin32.

The tests that are reading from STDERR using the 'stderr_is' sub are
failing due to the (\n|\r\n) translation that goes on in Perl under
Windows.

Snippet from 'dmake test' output:

t/010_basics/016_load_into_main................................
#   Failed test 'Moose warns when loaded from the main package'
#   at t/010_basics/016_load_into_main.t line 14.
# STDERR is:
# Moose does not export its sugar to the 'main' package.
#
# not:
# Moose does not export its sugar to the 'main' package.
#
# as expected

Here's the actual test t/010_basics/016_load_into_main.t:

stderr_is( sub { package main; eval 'use Moose' },
           "Moose does not export its sugar to the 'main' package.\n",
           'Moose warns when loaded from the main package' );

And here's the output of perl -e "use Moose;" in the Moose-0.77
distribution directory:

OSO# PERL5LIB=blib/lib perl -e "use Moose;"
Moose does not export its sugar to the 'main' package.

OSO# PERL5LIB=blib/lib perl -e "use Moose;" 2>&1| od -a
0000000   M   o   o   s   e  sp   d   o   e   s  sp   n   o   t  sp   e
0000020   x   p   o   r   t  sp   i   t   s  sp   s   u   g   a   r  sp
0000040   t   o  sp   t   h   e  sp   '   m   a   i   n   '  sp   p   a
0000060   c   k   a   g   e   .  cr  nl

As you can see, the extra CR in the output is throwing the test off.

Is there an easy way around this somewhere, or do I have to live with
it?  Setting binmode on the output filehandle on ($^O eq q(MSWin32))
is supposed to suppress the extra CR[2]; is there an easy place to
insert that function call for testing purposes?  For what it's worth,
the CRLF thing was the only thing that failed the tests in my build.

Thanks,

Brian

[1] http://code.google.com/p/camelbox/
[2] http://perldoc.perl.org/perlport.html#DOS-and-Derivatives

Reply via email to