develooper Front page | perl.perl5.porters | Postings from July 2017

Re: RFC: deprecate implicit-encoding "Wide character in print"behaviour

Thread Previous
From:
Kent Fredric
Date:
July 23, 2017 10:29
Subject:
Re: RFC: deprecate implicit-encoding "Wide character in print"behaviour
Message ID:
CAATnKFCmRp6v8jEExzWLh+F+F_YFRPCZm0YTxUf4XY2HJJPB8g@mail.gmail.com
On 23 July 2017 at 12:08, Zefram <zefram@fysh.org> wrote:
> Kent Fredric wrote:
>>I've seen *reams* of test suites that have this problem simply because
>>of the fun with needing to deal with marshalling your strings through
>>Test::More.
>
> Do you mean things like the got/expected output from a failed is() test?
> It periodically annoys me that this outputs control characters found
> in the data.

Yeah, sometimes the is/expected are different, but are different in
ways that *dont* pertain to their UTF8ness, they only differ in the
text content. From the context of the test, the failure is and only is
"substring of x and y is different", that X and Y are not in whatever
format your terminal/stdout accepts its not a bug in your *program*,
its a bug in the test layer.

Some of this is a bunch of historical warts in Test::Builder, but I
can't remember the details, I can only remember fighting with this
part of the test toolchain at some point to get it to do the "Right"
thing, only to discover years later that I did the wrong thing simply
to suppress the warning ( utf8::  is hard, who knew! )

If people similarly just do the wrong thing to avoid the exception...
well, that's not really a net improvement. Its still wrong, just
silently wrong.

But I'd rather not find myself debugging the test tooling when some
string I was comparing leaks to STDOUT and throws an exception when I
was trying to solve the problem of why the variables were different
from each other in the first place.

In short, this is the kind of error that you only see when other
errors are already happening, and it impedes your ability to diagnose
the real error because you have to cater to a cosmetic one.

I do suspect the underlying reason why this was a thing has been made
better in recent years, but I'm a little out of that loop atm. ( I
suspect it became standard practice to set :utf8 on STDOUT under
Test::More and it hid the problem that way )

But this argument for me is not so much *about* Test::More, its just
an example where making this stricter could cause unwanted problems,

--
KENTNL - https://metacpan.org/author/KENTNL

Thread Previous


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