summaryrefslogtreecommitdiff
path: root/lib/Text
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-06-16 18:35:46 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-06-16 18:35:46 +0000
commitd6ae291185af65510e5e8660d206e5aabbb7ae8e (patch)
treeda7558b83a6d7e28c8653b6f740376e31f7bbfe4 /lib/Text
parent908801fe7019314da9ec6cbe0d45f36d440c0aea (diff)
downloadperl-d6ae291185af65510e5e8660d206e5aabbb7ae8e.tar.gz
Try the new scheme by moving the Text::Abbrev test
to a new place under lib. p4raw-id: //depot/perl@10639
Diffstat (limited to 'lib/Text')
-rwxr-xr-xlib/Text/Abbrev/t/abbrev.t51
1 files changed, 51 insertions, 0 deletions
diff --git a/lib/Text/Abbrev/t/abbrev.t b/lib/Text/Abbrev/t/abbrev.t
new file mode 100755
index 0000000000..fb5a9841eb
--- /dev/null
+++ b/lib/Text/Abbrev/t/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++;