in reply to Unit test failing but "got" and "expected" are equal
Most likely you're getting tripped up by (weirdo?) whitespace or other stuff that renders identical in the terminal.
To better diagnose that, I would dump the output on failure in a way that makes the differences spottable:
my $res = $s->gets(13); if( !is $res, "hello, world!", "puts() and gets() ok") { (my $s = $res) =~ s!([^\w])!sprintf '\\x%02x', ord($1)!ge; diag $s; ($s = "hello, world!") =~ s!([^\w])!sprintf '\\x%02x', ord($1)!ge; diag $s; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Unit test failing but "got" and "expected" are equal
by stevieb (Canon) on Jan 04, 2019 at 20:11 UTC | |
by AnomalousMonk (Archbishop) on Jan 04, 2019 at 20:36 UTC | |
by stevieb (Canon) on Jan 04, 2019 at 21:08 UTC | |
by kschwab (Vicar) on Jan 05, 2019 at 05:06 UTC |