Subject: | Doesn't handle UTF-8 correctly. |
Consider this test file with an intentionally untidy line and some unicode in it:
twin% more t/not_tidy.t
use utf8;
use strict; # 火雞
use warnings;
use Test::More;
ok 1;
done_testing;
this is displayed incorrectly by Test::PerlTidy:
# The file 't/not_tidy.t' is not tidy
# +--+------------------------------------------+-------------------------------------------+
# | 1|use utf8; |use utf8; |
# * 2|use strict; # \xe7\x81\xab\xe9\x9b\x9e |use strict; # \xe7\x81\xab\xe9\x9b\x9e *
# | 3|use warnings; |use warnings; |
# | 4|use Test::More; |use Test::More; |
# | 5| | |
# +--+------------------------------------------+-------------------------------------------+
not ok 8 - 't/not_tidy.t'
# Failed test ''t/not_tidy.t''
# at t/perltidy.t line 11.
The correct output should look something like this:
# The file 't/not_tidy.t' is not tidy
# +--+----------------------------------+-----------------------------------+
# | 1|use utf8; |use utf8; |
# * 2|use strict; # \x{706b}\x{96de} |use strict; # \x{706b}\x{96de} *
# | 3|use warnings; |use warnings; |
# | 4|use Test::More; |use Test::More; |
# | 5| | |
# +--+----------------------------------+-----------------------------------+
not ok 8 - 't/not_tidy.t'
# Failed test ''t/not_tidy.t''
# at t/perltidy.t line 11.
It would be even better to display the actual characters itself, though this may not be possible with Text::Diff.