Skip Menu |

This queue is for tickets about the PerlIO-locale CPAN distribution.

Report information
The Basics
Id: 35675
Status: resolved
Priority: 0/
Queue: PerlIO-locale

People
Owner: RGARCIA [...] cpan.org
Requestors: user42 [...] zip.com.au
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.04
Fixed in: (no value)



Subject: suggest skip tests when locale not available
It'd be nice if the two test scripts using en_US.UTF-8 could skip their tests if that locale isn't available, instead of failing. I think the return value from setlocale says whether the locale setting worked or not. (I guess it'd be possible to dig among available locales to find a utf8 to try, I happened to have an en_IN.UTF-8 for instance, but that's probably more trouble than it's worth.)
This will be solved by the following change (thanks for the suggestion) : commit d80e76b03f48dc832d03e613c7366a071d046254 Author: Rafael Garcia-Suarez <rgarciasuarez@gmail.com> Date: Wed May 7 13:53:16 2008 +0200 Skip tests if en_US.UTF-8 is not found diff --git a/t/02utf8in.t b/t/02utf8in.t index 905bf62..3dab0a7 100644 --- a/t/02utf8in.t +++ b/t/02utf8in.t @@ -6,12 +6,16 @@ use Test::More tests => 1; use PerlIO::locale; use POSIX qw(locale_h); -setlocale(LC_CTYPE, "en_US.UTF-8"); -open(O, ">", "foo") or die $!; -print O "\xd0\xb0"; -close O; -open(I, "<:locale", "foo") or die $!; -is(ord(<I>), 0x430); -close I; +SKIP: { + setlocale(LC_CTYPE, "en_US.UTF-8") or skip("no such locale", 1); + + open(O, ">", "foo") or die $!; + print O "\xd0\xb0"; + close O; + open(I, "<:locale", "foo") or die $!; + is(ord(<I>), 0x430); + close I; +} + END { unlink "foo" } diff --git a/t/03utf8out.t b/t/03utf8out.t index 5fcd1dc..30da85b 100644 --- a/t/03utf8out.t +++ b/t/03utf8out.t @@ -6,14 +6,18 @@ use Test::More tests => 2; use PerlIO::locale; use POSIX qw(locale_h); -setlocale(LC_CTYPE, "en_US.UTF-8"); -open(O, ">:locale", "foo") or die $!; -print O "\x{430}"; -close O; -open(I, "<", "foo") or die $!; -local $/ = \1; -is(ord(<I>), 0xd0); -is(ord(<I>), 0xb0); -close I; +SKIP: { + setlocale(LC_CTYPE, "en_US.UTF-8") or skip("no such locale", 1); + + open(O, ">:locale", "foo") or die $!; + print O "\x{430}"; + close O; + open(I, "<", "foo") or die $!; + local $/ = \1; + is(ord(<I>), 0xd0); + is(ord(<I>), 0xb0); + close I; +} + END { unlink "foo" }