require 'test.pl';
}
-plan tests => 3;
+plan tests => 4;
use POSIX qw();
SKIP: {
- skip("mblen() not present", 3) unless $Config{d_mblen};
+ skip("mblen() not present", 4) unless $Config{d_mblen};
is(&POSIX::mblen("a", &POSIX::MB_CUR_MAX), 1, 'mblen() basically works');
- skip("LC_CTYPE locale support not available", 2)
+ skip("LC_CTYPE locale support not available", 3)
unless locales_enabled('LC_CTYPE');
my $utf8_locale = find_utf8_ctype_locale();
- skip("no utf8 locale available", 2) unless $utf8_locale;
+ skip("no utf8 locale available", 3) unless $utf8_locale;
local $ENV{LC_CTYPE} = $utf8_locale;
local $ENV{LC_ALL};
delete $ENV{LC_ALL};
+ fresh_perl_like(
+ 'use POSIX; print &POSIX::MB_CUR_MAX',
+ qr/[4-6]/, {}, 'MB_CUR_MAX is at least 4 in a UTF-8 locale');
+
+ SKIP: {
+ my ($major, $minor, $rest) = $Config{osvers} =~ / (\d+) \. (\d+) .* /x;
+ skip("mblen() broken (at least for c.utf8) on early HP-UX", 1)
+ if $Config{osname} eq 'hpux'
+ && $major < 11 || ($major == 11 && $minor < 31);
fresh_perl_is(
'use POSIX; print &POSIX::mblen("'
. I8_to_native("\x{c3}\x{28}")
. '", 2)',
-1, {}, 'mblen() recognizes invalid multibyte characters');
+ }
fresh_perl_is(
'use POSIX; print &POSIX::mblen("\N{GREEK SMALL LETTER SIGMA}", 2)',