Skip to content

Commit

Permalink
Merge pull request #59 from choroba/turkic
Browse files Browse the repository at this point in the history
Reset the original locale after testing the Turkic locale
  • Loading branch information
choroba authored Jun 20, 2024
2 parents 7ccc68f + 6c1d49d commit eb22d25
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Revision history for Syntax-Construct

1.037 2024-06-20
- Fix turkic casing: reset original locale

1.036 2024-06-12
- Fix treating some stable versions as unstable

Expand Down
12 changes: 8 additions & 4 deletions lib/Syntax/Construct.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.006002;
use strict;
use warnings;

our $VERSION = '1.036';
our $VERSION = '1.037';

my %introduces = do { no warnings 'qw';
( '5.040' => [qw[
Expand Down Expand Up @@ -201,8 +201,12 @@ sub _hook {
eval {
use locale;
require POSIX;
POSIX::setlocale(POSIX::LC_ALL(), 'tr_TR.UTF-8');
lc 'I' ne 'i'
my $orig_locale = POSIX::setlocale(POSIX::LC_CTYPE());
(POSIX::setlocale(POSIX::LC_CTYPE(), 'tr_TR.UTF-8') || "")
eq 'tr_TR.UTF-8' or die;
my $cmp = lc 'I' ne 'i';
POSIX::setlocale(POSIX::LC_CTYPE(), $orig_locale);
$cmp
} or die 'Turkic locale casing not working at '
. _position(1) . "\.\n";
},
Expand Down Expand Up @@ -297,7 +301,7 @@ Syntax::Construct - Explicitly state which non-feature constructs are used in th
=head1 VERSION
Version 1.036
Version 1.037
=head1 SYNOPSIS
Expand Down
9 changes: 7 additions & 2 deletions t/02-constructs.t
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,13 @@ my %tests = (
q("\N{ORIYA DIGIT FOUR}" =~ m'\N{ORIYA DIGIT FOUR}'), 1 ],
[ 'turkic-casing',
'use locale; use POSIX "locale_h";' . skippable(
'eval{setlocale(LC_ALL, "tr_TR.UTF-8") eq "tr_TR.UTF-8" or die;'
. ' lc "I" eq "\N{LATIN SMALL LETTER DOTLESS I}"}',
'my $o = setlocale(LC_CTYPE);'
. 'eval {'
. '(setlocale(LC_CTYPE, "tr_TR.UTF-8") || "") eq "tr_TR.UTF-8"'
. 'or die;'
. 'my $r = lc "I" eq "\N{LATIN SMALL LETTER DOTLESS I}";'
. 'setlocale(LC_CTYPE, $o);'
. '$r }',
'": testing locale not supported"',
"", '1'),
1 ],
Expand Down

0 comments on commit eb22d25

Please sign in to comment.