Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RT76037: fix Win32 tests failures and EOL issues in t/12-fail.t #2

Merged
merged 8 commits into from Sep 8, 2012

Conversation

dolmen
Copy link
Contributor

@dolmen dolmen commented Sep 8, 2012

This serie of patches fixes major flaws in how t/12-fail.t, so that the code is now portable on Win32 and trailing ^M and spaces are fixed.
https://rt.cpan.org/Ticket/Display.html?id=76037

The major issue in t/12-fail.t was that raw ^M were used. However perl on Win32 eats thoses, so the generated files that were erroneous were not, and so tested files had not the issue that the test expected. The point of Test::EOL is to avoid ^M in files. This is not just for cosmetic reasons. This is also to avoid such issues. So commit c0662b4 cleans up ^M at EOL and replaces them with "\r" that are expanded by Perl.

Another issue was that t/12-fail.t had trailing spaces. What a shame! And due to the first issue, trailing spaces check was disabled!

So now the sources are EOL clean and this is enforced by using Test::EOL on itself.

If the destination for &2 must be the same as &1 (2>&1), &1 must be redirected
before &2 is redirected. This is not Win32 specific.
Refactor common test code in sub run_ok().
Add test for exit code.
Fix check of output.
Some tests still fail on Win32.
Fix almost all tests on Win32 by NEVER using raw ^M.

The rule: DO NOT USE RAW ^M IN SOURCE CODE. That's not portable!
Avoiding those problems is the point of disallowing ^M with Test:EOL. I can't
understand why the Test::EOL maintainers didn't apply that rule to themselves.

Test 'make_bad_file_3' is so broken that I don't understand what it is
supposed to do, so I just translated raw ^M to "\r" for now.
Yes, 12-fail.t was so broken that it had trailing spaces...
To avoid an other shame (see commit 1ec979a) and ensure future Win32
portability, apply all Test::EOL strictures on ourself.
Cleanup the the last failing test on Win32: 'bad_file_3' generated file is
now a pure Win32 file (without the fancy crazy \r it had before).
The failure is now expected at line 1, instead of line 9 as the first line with
\r is line 1. (I don't understand why Test::EOL was supposed to detect only
fancy multiple \r instead of *any*).

Now, all tests pass on Win32 (RT#76037)!
@bobtfish bobtfish merged commit dffb70e into bobtfish:master Sep 8, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants