From: Perl 5 Porters Date: Mon, 23 Sep 1996 09:33:01 +0000 (+0200) Subject: perl 5.003_06: t/lib/abbrev.t X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1ab872dad76f8ad01b881881eaac152a79eb3864;p=p5sagit%2Fp5-mst-13.2.git perl 5.003_06: t/lib/abbrev.t Date: Sun, 22 Sep 1996 00:59:56 +0200 From: Gisle Aas Subject: More standard library test scripts This is a collection of test scripts for the standard library modules. Some of the tests does not pass unless some of the patches I have sent out are applied. Date: 23 Sep 1996 11:33:01 +0200 From: Ulrich Pfeifer Subject: Text::Abbrev (Re: More standard library test scripts) This patch merges the Text::Abbrev related patches/tests from Gisle and my previous patch (i.e. replaces both). --- diff --git a/t/lib/abbrev.t b/t/lib/abbrev.t new file mode 100644 index 0000000..fb5a984 --- /dev/null +++ b/t/lib/abbrev.t @@ -0,0 +1,51 @@ +#!./perl + +print "1..7\n"; + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + +use Text::Abbrev; + +print "ok 1\n"; + +# old style as reference +local(%x); +my @z = qw(list edit send abort gripe listen); +abbrev(*x, @z); +my $r = join ':', sort keys %x; +print "not " if exists $x{'l'} || + exists $x{'li'} || + exists $x{'lis'}; +print "ok 2\n"; + +print "not " unless $x{'list'} eq 'list' && + $x{'liste'} eq 'listen' && + $x{'listen'} eq 'listen'; +print "ok 3\n"; + +print "not " unless $x{'a'} eq 'abort' && + $x{'ab'} eq 'abort' && + $x{'abo'} eq 'abort' && + $x{'abor'} eq 'abort' && + $x{'abort'} eq 'abort'; +print "ok 4\n"; + +my $test = 5; + +# wantarray +my %y = abbrev @z; +my $s = join ':', sort keys %y; +print (($r eq $s)?"ok $test\n":"not ok $test\n"); $test++; + +my $y = abbrev @z; +$s = join ':', sort keys %$y; +print (($r eq $s)?"ok $test\n":"not ok $test\n"); $test++; + +%y = (); +abbrev \%y, @z; + +$s = join ':', sort keys %y; +print (($r eq $s)?"ok $test\n":"not ok $test\n"); $test++;