| 1 | #!./perl |
| 2 | |
| 3 | BEGIN { |
| 4 | chdir 't' if -d 't'; |
| 5 | @INC = '../lib'; |
| 6 | require Config; import Config; |
| 7 | if (!$Config{d_setlocale} || $Config{ccflags} =~ /\bD?NO_LOCALE\b/) { |
| 8 | print "1..0\n"; |
| 9 | exit; |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | print "1..7\n"; |
| 14 | |
| 15 | use I18N::Collate; |
| 16 | |
| 17 | print "ok 1\n"; |
| 18 | |
| 19 | $a = I18N::Collate->new("foo"); |
| 20 | |
| 21 | print "ok 2\n"; |
| 22 | |
| 23 | { |
| 24 | use warnings; |
| 25 | local $SIG{__WARN__} = sub { $@ = $_[0] }; |
| 26 | $b = I18N::Collate->new("foo"); |
| 27 | print "not " unless $@ =~ /\bHAS BEEN DEPRECATED\b/; |
| 28 | print "ok 3\n"; |
| 29 | $@ = ''; |
| 30 | } |
| 31 | |
| 32 | print "not " unless $a eq $b; |
| 33 | print "ok 4\n"; |
| 34 | |
| 35 | $b = I18N::Collate->new("bar"); |
| 36 | print "not " if $@ =~ /\bHAS BEEN DEPRECATED\b/; |
| 37 | print "ok 5\n"; |
| 38 | |
| 39 | print "not " if $a eq $b; |
| 40 | print "ok 6\n"; |
| 41 | |
| 42 | print "not " if $a lt $b == $a gt $b; |
| 43 | print "ok 7\n"; |
| 44 | |