Subject: | Test failure caused by inconsistent condition |
The constructor uses the defined-or // operator to define a default values for hostname and user properties, when those values can't be extracted from environment:
has hostname => (is => 'ro', default => $ENV{HOSTNAME} // 'unknown');
has user => (is => 'rw', default => $ENV{USER} // 'unknown');
However, the test check if the hostname property has this default value if the HOSTNAME environment variable is false (and not undefined), resulting in a test failure if this variable is defined, but empty:
HOSTNAME= prove -b t/00-basic.t
t/00-basic.t .. 1/? #
# Failed test 'Error setting hostname'
# at t/00-basic.t line 11.
# Looks like you failed 1 test of 8.
t/00-basic.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/8 subtests
The attached patch fix this issue.
Subject: | Net-FreeDB-0.10-fix-test.patch |
--- t/00-basic.t~ 2020-09-05 17:38:46.697263153 +0200
+++ t/00-basic.t 2020-09-05 17:40:00.261835920 +0200
@@ -4,7 +4,7 @@
my $freedb = new_ok("Net::FreeDB");
-if ($ENV{HOSTNAME}) {
+if (defined $ENV{HOSTNAME}) {
ok($freedb->hostname eq $ENV{HOSTNAME}, 'Error setting hostname');
} else {
diag($freedb->hostname);