Skip to content

Commit

Permalink
save work
Browse files Browse the repository at this point in the history
  • Loading branch information
tbrowder committed Jan 19, 2024
1 parent 62c423d commit ec7ae13
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
9 changes: 5 additions & 4 deletions docs/README.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ returns the original set with added unique abbreviations for the set.
module.)

A natural consequence of generating all the abbreviations for a
set of one word is this: the ouput
set of one word is this: the ouput
provides the parts of a junction which matches any
partial length of the target word. For example, given a target
word 'Args':
Expand All @@ -33,8 +33,9 @@ word 'Args':
use Abbreviations;
use Test;
my $target = "Args";
my $junction = abbrev $target; # OUTPUT: "A|Ar|Arg|Args";
my $junction = abbrev $target; # OUTPUT: «"A|Ar|Arg|Args"␤»;
my $res = False;
my @w = $junction.split('|');
for @w {
when /$junction/ {
$res = True
Expand All @@ -43,7 +44,7 @@ for @w {
$res = False
}
}
is $res, True; # OUTPUT: ok 1
is $res, True; # OUTPUT: «ok 1␤»
=end code

Its signature:
Expand Down Expand Up @@ -224,7 +225,7 @@ the C<:$reverse> option is used. This is the routine used for all the
output types produced by this module I<except> the
I<AbbrevList> (C<AL>) which keeps the original word set order.

The routine's output can be modified for other uses by entering the
The routine's output can be modified for other uses by entering the
C<:$type> parameter to choose another of the <enum Sort-type>s.

=head3 C<enum Sort-type>
Expand Down
19 changes: 10 additions & 9 deletions t/3-unusual-inputs.t
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ is-deeply $dow, @d, "AL test on days of the week";
$dow = abbrevs @w;
is $dow, "A|Ar|Arg|Args", "Single word => /regex junction/";

@w = <A|Ar|Arg|Args>;
# input tests
@w = <A Ar Arg Args>;
my $res = False;
for @w {
when /A|Ar|Arg|Args/ {
when /(A|Ar|Arg|Args)/ {
$res = True
}
default {
Expand All @@ -83,10 +84,10 @@ for @w {
}
is $res, True;

my $junction = "A|Ar|Arg|Args";
my $junction = 'A|Ar|Arg|Args';
$res = False;
for @w {
when /$junction/ {
when /<$junction>/ {
$res = True
}
default {
Expand All @@ -95,10 +96,10 @@ for @w {
}
is $res, True;

$junction = "A|Ar|Arg|Args|N";
$junction = "A|Ar|Arg|Args|N";
$res = False;
for @w {
when /$junction/ {
when /^<$junction>/ {
$res = True
}
default {
Expand All @@ -110,10 +111,10 @@ is $res, False;
subtest {
# example in README
my $target = "Args";
my $junction = abbrev $target; # OUTPUT: "A|Ar|Arg|Args";
my $junction = abbrev $target; # OUTPUT: "A|Ar|Arg|Args";
my $res = False;
for $junction.split(/'|'/) {
when /$junction/ { $res = True }
for @w { #$junction.split(/'|'/) {
when /<$junction>/ { $res = True }
default { $res = False }
}
is $res, True, "README example"; # OUTPUT: ok 1
Expand Down

0 comments on commit ec7ae13

Please sign in to comment.