BEGIN {
chdir 't' if -d 't';
- @INC = qw(../lib .);
+ require "./test.pl";
+ set_up_inc( qw(../lib .) );
require Config; import Config;
- require "test.pl";
+ require "./loc_tools.pl";
}
plan tests => 60;
# 104 non-backslash characters
is(tr/\\//cd, 104, "tr count non-backslashed");
} else { # some ASCII descendant, then.
- $_ = join "", map chr($_), 32..127;
+ $_ = join "", map chr(utf8::unicode_to_native($_)), 32..127;
# 96 characters - 52 letters - 10 digits - 1 underscore = 33 backslashes
# 96 characters + 33 backslashes = 129 characters
is(quotemeta($char), "\\$char", "quotemeta '\\N{U+D7}' in UTF-8");
is(length(quotemeta($char)), 2, "quotemeta '\\N{U+D7}' in UTF-8 length");
-$char = "\N{U+D8}";
+$char = "\N{U+DF}";
utf8::upgrade($char);
-is(quotemeta($char), "$char", "quotemeta '\\N{U+D8}' in UTF-8");
-is(length(quotemeta($char)), 1, "quotemeta '\\N{U+D8}' in UTF-8 length");
+is(quotemeta($char), "$char", "quotemeta '\\N{U+DF}' in UTF-8");
+is(length(quotemeta($char)), 1, "quotemeta '\\N{U+DF}' in UTF-8 length");
{
no feature 'unicode_strings';
- is(quotemeta("\x{d7}"), "\\\x{d7}", "quotemeta Latin1 no unicode_strings quoted");
- is(length(quotemeta("\x{d7}")), 2, "quotemeta Latin1 no unicode_strings quoted length");
- is(quotemeta("\x{d8}"), "\\\x{d8}", "quotemeta Latin1 no unicode_strings quoted");
- is(length(quotemeta("\x{d8}")), 2, "quotemeta Latin1 no unicode_strings quoted length");
+
+ # BF is chosen because it is NOt alphanumeric in both Latin1 and EBCDIC
+ # DF is chosen because it IS alphanumeric in both Latin1 and EBCDIC
+ is(quotemeta("\x{bf}"), "\\\x{bf}", "quotemeta Latin1 no unicode_strings quoted");
+ is(length(quotemeta("\x{bf}")), 2, "quotemeta Latin1 no unicode_strings quoted length");
+ is(quotemeta("\x{df}"), "\\\x{df}", "quotemeta Latin1 no unicode_strings quoted");
+ is(length(quotemeta("\x{df}")), 2, "quotemeta Latin1 no unicode_strings quoted length");
SKIP: {
- skip 'No locale testing without d_setlocale', 8 if(!$Config{d_setlocale});
- require locale; import locale;
+ skip 'Locales not available', 8 unless locales_enabled('LC_CTYPE');
+ use locale;
my $char = ":";
is(quotemeta($char), "\\$char", "quotemeta '$char' locale");
is(quotemeta($char), "$char", "quotemeta '$char' locale");
is(length(quotemeta($char)), 1, "quotemeta '$char' locale");
- my $char = "\x{D7}";
- is(quotemeta($char), "\\$char", "quotemeta '\\x{D7}' locale");
- is(length(quotemeta($char)), 2, "quotemeta '\\x{D7}' locale length");
+ my $char = "\x{BF}";
+ is(quotemeta($char), "\\$char", "quotemeta '\\x{BF}' locale");
+ is(length(quotemeta($char)), 2, "quotemeta '\\x{BF}' locale length");
- $char = "\x{D8}"; # Every non-ASCII Latin1 is quoted in locale.
- is(quotemeta($char), "\\$char", "quotemeta '\\x{D8}' locale");
- is(length(quotemeta($char)), 2, "quotemeta '\\x{D8}' locale length");
+ $char = "\x{DF}"; # Every non-ASCII Latin1 is quoted in locale.
+ is(quotemeta($char), "\\$char", "quotemeta '\\x{DF}' locale");
+ is(length(quotemeta($char)), 2, "quotemeta '\\x{DF}' locale length");
}
}
{
use feature 'unicode_strings';
- is(quotemeta("\x{d7}"), "\\\x{d7}", "quotemeta Latin1 unicode_strings quoted");
- is(length(quotemeta("\x{d7}")), 2, "quotemeta Latin1 unicode_strings quoted length");
- is(quotemeta("\x{d8}"), "\x{d8}", "quotemeta Latin1 unicode_strings nonquoted");
- is(length(quotemeta("\x{d8}")), 1, "quotemeta Latin1 unicode_strings nonquoted length");
+ is(quotemeta("\x{bf}"), "\\\x{bf}", "quotemeta Latin1 unicode_strings quoted");
+ is(length(quotemeta("\x{bf}")), 2, "quotemeta Latin1 unicode_strings quoted length");
+ is(quotemeta("\x{df}"), "\x{df}", "quotemeta Latin1 unicode_strings nonquoted");
+ is(length(quotemeta("\x{df}")), 1, "quotemeta Latin1 unicode_strings nonquoted length");
SKIP: {
- skip 'No locale testing without d_setlocale', 12 if(!$Config{d_setlocale});
- BEGIN {
- if($Config{d_setlocale}) {
- require locale; import locale;
- }
- }
+ skip 'Locales not available', 12 unless locales_enabled('LC_CTYPE');
+ use locale;
my $char = ":";
utf8::upgrade($char);
is(quotemeta($char), "\\$char", "quotemeta '\\N{U+D7}' locale in UTF-8");
is(length(quotemeta($char)), 2, "quotemeta '\\N{U+D7}' locale in UTF-8 length");
- $char = "\N{U+D8}"; # Every non-ASCII Latin1 is quoted in locale.
+ $char = "\N{U+DF}"; # Every non-ASCII Latin1 is quoted in locale.
utf8::upgrade($char);
- is(quotemeta($char), "\\$char", "quotemeta '\\N{U+D8}' locale in UTF-8");
- is(length(quotemeta($char)), 2, "quotemeta '\\N{U+D8}' locale in UTF-8 length");
+ is(quotemeta($char), "\\$char", "quotemeta '\\N{U+DF}' locale in UTF-8");
+ is(length(quotemeta($char)), 2, "quotemeta '\\N{U+DF}' locale in UTF-8 length");
is(quotemeta("\x{263a}"), "\\\x{263a}", "quotemeta locale Unicode quoted");
is(length(quotemeta("\x{263a}")), 2, "quotemeta locale Unicode quoted length");