xref: /openbsd-src/gnu/usr.bin/perl/cpan/Encode/t/encoding-locale.t (revision c90a81c56dcebd6a1b73fe4aff9b03385b8e63b3)
1#
2# This test aims to detect (using CPAN Testers) platforms where the locale
3# encoding detection doesn't work.
4#
5
6use strict;
7use warnings;
8
9use Test::More tests => 3;
10
11use encoding ();
12use Encode qw<find_encoding>;
13
14my $locale_encoding = encoding::_get_locale_encoding;
15
16SKIP: {
17    is(ref $locale_encoding, '', '_get_locale_encoding returns a scalar value')
18	or skip 'no locale encoding found', 1;
19
20    my $enc = find_encoding($locale_encoding);
21    ok(defined $enc, 'encoding returned is supported')
22	or diag("Encoding: ", explain($locale_encoding));
23    isa_ok($enc, 'Encode::Encoding');
24    note($locale_encoding, ' => ', $enc->name);
25}
26