| 1 |
#!./perl |
| 2 |
|
| 3 |
# at least in the CPAN version we're sometimes called with -w, for example |
| 4 |
# during 'make test', so disable them explicitly and only turn them on again for |
| 5 |
# the deprecation test. |
| 6 |
use strict; |
| 7 |
no warnings; |
| 8 |
|
| 9 |
BEGIN { |
| 10 |
require Config; import Config; |
| 11 |
if (!$::Config{d_setlocale} || $::Config{ccflags} =~ /\bD?NO_LOCALE\b/) { |
| 12 |
print "1..0\n"; |
| 13 |
exit; |
| 14 |
} |
| 15 |
} |
| 16 |
|
| 17 |
use Test::More tests => 7; |
| 18 |
|
| 19 |
BEGIN {use_ok('I18N::Collate');} |
| 20 |
|
| 21 |
$a = I18N::Collate->new("foo"); |
| 22 |
|
| 23 |
isa_ok($a, 'I18N::Collate'); |
| 24 |
|
| 25 |
{ |
| 26 |
use warnings; |
| 27 |
local $SIG{__WARN__} = sub { $@ = $_[0] }; |
| 28 |
$b = I18N::Collate->new("foo"); |
| 29 |
like($@, qr/\bHAS BEEN DEPRECATED\b/); |
| 30 |
$@ = ''; |
| 31 |
} |
| 32 |
|
| 33 |
is($a, $b, 'same object'); |
| 34 |
|
| 35 |
$b = I18N::Collate->new("bar"); |
| 36 |
unlike($@, qr/\bHAS BEEN DEPRECATED\b/); |
| 37 |
|
| 38 |
isnt($a, $b, 'different object'); |
| 39 |
|
| 40 |
cmp_ok($a lt $b, '!=', $a gt $b); |