# This test is ill conceived.  
# The file it creates may not recognisably have an en-dash
# It works without using the File::Rename unicode_strings option
# RMB 2021-08-01

use Test::More;
plan skip_all => 'Need perl 5.14.0 for \N', 2 if $] < 5.016;
plan tests => 2;

require_ok('File::Rename');

#########################

# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.

unshift @INC, 't' if -d 't';
require 'testlib.pl';

my $dir = do { require File::Temp; File::Temp::tempdir(); };
chdir $dir or die;

my $test = "A \x{2013} B.txt";  # en dash
my $xxx = 'A XXX B.txt';
create_file($test) or die;

our $found;
our $print;
our $warn;
local $SIG{__WARN__} = sub { $warn .= $_[0] };

my $s = sub { s/\N{EN DASH}+/XXX/ };
 
test_rename_files($s, $test); 
ok( (-e $xxx and !-e $test and $found), "rename with \\N{EN DASH}");
diag_rename();
 
