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