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.
6use strict;
7no warnings;
8
9BEGIN {
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
17use Test::More tests => 7;
18
19BEGIN {use_ok('I18N::Collate');}
20
21$a = I18N::Collate->new("foo");
22
23isa_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
33is($a, $b, 'same object');
34
35$b = I18N::Collate->new("bar");
36unlike($@, qr/\bHAS BEEN DEPRECATED\b/);
37
38isnt($a, $b, 'different object');
39
40cmp_ok($a lt $b, '!=', $a gt $b);
41