File: 180_full_text.t

package info (click to toggle)
libtest-regexp-perl 2016060501-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 224 kB
  • ctags: 30
  • sloc: perl: 1,320; makefile: 2
file content (34 lines) | stat: -rwxr-xr-x 735 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
31
32
33
34
#!/usr/bin/perl

use strict;
use warnings;
no  warnings 'syntax';

use 5.010;

use Test::Tester;
use Test::Regexp;
use Test::More 0.88;

my $subject        = "0123456789" x 10;
my $trunc_subject  = "0123456789" x 5;
   $trunc_subject .= "...56789";

my $pat = qr /.+/;

foreach my $full_text (0, 1) {
    my ($premature, @results) = run_tests sub {
        match subject   => "$subject",
              pattern   => $pat,
              full_text => $full_text,
        ;
    };
    my $exp_subject = $full_text ? $subject : $trunc_subject;
    my $not         = $full_text ? "not "   : "";

    is $results [0] {name}, qq {qq {$exp_subject} matched by /$pat/},
                           "Subject is ${not}truncated";
}


done_testing;