develooper Front page | perl.win32.vanilla | Postings from April 2009

How to fix tests that fail on Win32 due to CR/LF newlines?

Thread Next
From:
Dan Dascalescu
Date:
April 17, 2009 22:05
Subject:
How to fix tests that fail on Win32 due to CR/LF newlines?
Message ID:
3561cc6d0904172204o6837df18yc99ef328a2f303da@mail.gmail.com
What are the recommended practices in adapting .t files to be
independent of the newline style?

I've seen various tests fail on Windows because they end up expecting
\n and get \r\n. For example, in Email::MIME::Modifier's t/encoding.t:

# $email->encoding_set('base64');
# is $email->body, qq[Hello World!\nI like you!\n], 'base64 works';  #
test passes
# is $email->body_raw, qq[SGVsbG8gV29ybGQhCkkgbGlrZSB5b3UhCg==\n],
'base64 raw works';  # test fails on Windows

Conditional testing on $^O eq 'MSWin32'? Seems like a hack.

Thanks,
Dan

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About