Skip to content

Commit

Permalink
[i] fix typo with colection spelled with one 'l' in Matches.pm
Browse files Browse the repository at this point in the history
Took 5 minutes

Took 5 minutes
  • Loading branch information
AlexP007 committed Jan 13, 2022
1 parent 232a897 commit 0d3c706
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
1.21 2022-01-12 08:49:06-07:00 Europe/Moscow
- Regex::Object::Matches->captures_all typo in method body with collection spelled with one 'l'

1.20 2022-01-12 18:49:03-05:00 Europe/Moscow
- Regex::Object::Matches collection
- Regex::Object->match_all method to abstract from while when global searching
Expand Down
2 changes: 1 addition & 1 deletion dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ license = Perl_5
copyright_holder = Alexander Panteleev
copyright_year = 2022

version = 1.20
version = 1.21

[AutoPrereqs]

Expand Down
4 changes: 2 additions & 2 deletions lib/Regex/Object.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use Regex::Object::Matches;
use Moo;
use namespace::clean;

our $VERSION = '1.20';
our $VERSION = '1.21';

tie my %nc, "Tie::Hash::NamedCapture";
tie my %nca, "Tie::Hash::NamedCapture", all => 1;
Expand Down Expand Up @@ -84,7 +84,7 @@ Regex::Object - solves problems with global Regex variables side effects.
=head1 VERSION
version 1.20
version 1.21
=head1 SYNOPSIS
Expand Down
2 changes: 1 addition & 1 deletion lib/Regex/Object/Matches.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ sub match_all {
sub captures_all {
my $self = shift;

return [map { $_->captures } @{$self->colection}];
return [map { $_->captures } @{$self->collection}];
}

1;
17 changes: 15 additions & 2 deletions t/02_matches.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use strict;
use warnings qw/FATAL/;
use utf8;

use Test::Simple tests => 7;
use Test::Simple tests => 8;
use Regex::Object;

$|=1;
Expand Down Expand Up @@ -99,7 +99,7 @@ ok($result eq $expected,
);

## TEST 7
# Test global matching with scoped regex with modifiers
# Test global matching with scoped regex with modifiers: match_all method

$re = Regex::Object->new(
regex => qr/([A-Z]+?) ([A-Z]+)/i,
Expand All @@ -114,3 +114,16 @@ ok($result eq $expected,
$expected,
)
);

## TEST 8
# Test global matching with scoped regex with modifiers: captures_all

$expected = 'John Doe Eric Lide Hans Zimmermann';
$result = join "\040", map { join "\040", @$_ } @{ $re->match_all($expected)->captures_all };

ok($result eq $expected,
sprintf('Returns wrong value: %s, expected: %s',
$result,
$expected,
)
);

0 comments on commit 0d3c706

Please sign in to comment.