[inseparable changes from patch to perl 5.004_04]
[p5sagit/p5-mst-13.2.git] / t / lib / abbrev.t
CommitLineData
1ab872da 1#!./perl
2
3print "1..7\n";
4
5BEGIN {
6 chdir 't' if -d 't';
7 @INC = '../lib';
8}
9
10use Text::Abbrev;
11
12print "ok 1\n";
13
14# old style as reference
15local(%x);
16my @z = qw(list edit send abort gripe listen);
17abbrev(*x, @z);
18my $r = join ':', sort keys %x;
19print "not " if exists $x{'l'} ||
20 exists $x{'li'} ||
21 exists $x{'lis'};
22print "ok 2\n";
23
24print "not " unless $x{'list'} eq 'list' &&
25 $x{'liste'} eq 'listen' &&
26 $x{'listen'} eq 'listen';
27print "ok 3\n";
28
29print "not " unless $x{'a'} eq 'abort' &&
30 $x{'ab'} eq 'abort' &&
31 $x{'abo'} eq 'abort' &&
32 $x{'abor'} eq 'abort' &&
33 $x{'abort'} eq 'abort';
34print "ok 4\n";
35
36my $test = 5;
37
38# wantarray
39my %y = abbrev @z;
40my $s = join ':', sort keys %y;
41print (($r eq $s)?"ok $test\n":"not ok $test\n"); $test++;
42
43my $y = abbrev @z;
44$s = join ':', sort keys %$y;
45print (($r eq $s)?"ok $test\n":"not ok $test\n"); $test++;
46
47%y = ();
48abbrev \%y, @z;
49
50$s = join ':', sort keys %y;
51print (($r eq $s)?"ok $test\n":"not ok $test\n"); $test++;