Subject: | Test failures in non-English locales |
t/dir.t and t/errors.t currently fail in non-English locales, because they hardcode English error messages. One way of fixing this is calling setlocale(LC_ALL, "C") in the test scripts, as per the attached trivial patch.
Subject: | 0001-Set-the-locale-to-C-for-test-scripts-that-hardcode-E.patch |
From f66a3470a674b924901941c1f29c6e18221b1608 Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Tue, 8 Dec 2015 23:21:01 +0200
Subject: [PATCH] Set the locale to C for test scripts that hardcode English
error messages
This fixes test failures in other locales, like fr_FR.UTF-8.
---
t/dir.t | 5 +++++
t/errors.t | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/t/dir.t b/t/dir.t
index 856fe0f..41aed6c 100755
--- a/t/dir.t
+++ b/t/dir.t
@@ -7,6 +7,11 @@ use Test::More qw(no_plan);
use File::Fu;
+use POSIX qw(locale_h);
+
+# tests hardcode English error messages
+setlocale(LC_ALL, "C");
+
{
my $d = File::Fu->dir("foo." . $$);
$d->e and $d->rmdir;
diff --git a/t/errors.t b/t/errors.t
index 635bf9d..26c6978 100755
--- a/t/errors.t
+++ b/t/errors.t
@@ -7,6 +7,11 @@ use Test::More qw(no_plan);
use File::Fu;
+use POSIX qw(locale_h);
+
+# tests hardcode English error messages
+setlocale(LC_ALL, "C");
+
{ # invalid ops
my $f = File::Fu->dir;
--
2.6.2