Subject: | t/10-list.t may fail (depending on locale?) |
The test suite fails on some of my smokers with a rather cryptic diagnostics:
...
# Failed test at t/10-list.t line 38.
(Die On Fail) at t/10-list.t line 38.
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 255 after test #7.
# Seeded srand with seed '20191205' from local date.
t/10-list.t ............
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 1/7 subtests
...
Unfortunately the test is using ok() which usually gives poor diagnostics in case of failures --- using is() or is_deeply() would be better. After changing the test using the following diff:
diff --git a/t/10-list.t b/t/10-list.t
index 4ad5b9f..c7da470 100644
--- a/t/10-list.t
+++ b/t/10-list.t
@@ -1,5 +1,6 @@
use Test2::V0;
use Test2::Plugin::DieOnFail;
+use Test2::Tools::Compare;
use Modern::Perl;
use Util::Medley::List;
use Data::Printer alias => 'pdump';
@@ -35,10 +36,7 @@ ok($min == 4);
my @sorted = $list->nsort(qw(foobar bizbaz Foobar Bizbaz));
-ok($sorted[0] eq 'bizbaz');
-ok($sorted[1] eq 'Bizbaz');
-ok($sorted[2] eq 'foobar');
-ok($sorted[3] eq 'Foobar');
+is(\@sorted, [qw(bizbaz Bizbaz foobar Foobar)]);
#####################################
# undefsToStrings
the diagnostics is more useful:
...
not ok 7
# Failed test at t/10-list.t line 39.
# +------+--------+----+--------+
# | PATH | GOT | OP | CHECK |
# +------+--------+----+--------+
# | [0] | Bizbaz | eq | bizbaz |
# | [1] | bizbaz | eq | Bizbaz |
# | [2] | Foobar | eq | foobar |
# | [3] | foobar | eq | Foobar |
# +------+--------+----+--------+
(Die On Fail) at t/10-list.t line 39.
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 255 after test #7.
...
So there seem to be problems with the case. And it seems that it depends on the current locale:
$ env LC_ALL=en_US.UTF-8 perl5.30.1 -Mblib t/10-list.t
-> passes
$ env LC_ALL=C perl5.30.1 -Mblib t/10-list.t
-> fails