File: 008-regex.t

package info (click to toggle)
libdata-printer-perl 1.002001-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 748 kB
  • sloc: perl: 4,364; makefile: 7; sh: 1
file content (30 lines) | stat: -rw-r--r-- 624 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use strict;
use warnings;
use Test::More tests => 3;
use Data::Printer::Object;

my $ddp = Data::Printer::Object->new( colored => 0 );

my $regex_with_modifiers = qr{(?:moo(\d|\s)*[a-z]+(.?))}i;
is(
    $ddp->parse(\$regex_with_modifiers),
    '(?:moo(\d|\s)*[a-z]+(.?))  (modifiers: i)',
    'regex with modifiers'
);

my $plain_regex = qr{(?:moo(\d|\s)*[a-z]+(.?))};
is(
    $ddp->parse(\$plain_regex),
    '(?:moo(\d|\s)*[a-z]+(.?))',
    'plain regex'
);

my $creepy_regex = qr{
      |
    ^ \s* go \s
}x;
is(
    $ddp->parse(\$creepy_regex),
    "\n      |\n    ^ \\s* go \\s\n  (modifiers: x)",
    'creepy regex'
);