File: 05-grep.t

package info (click to toggle)
libterm-ttyrec-plus-perl 0.09-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 596 kB
  • sloc: perl: 2,219; makefile: 7
file content (20 lines) | stat: -rw-r--r-- 599 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
use Test::More tests => 4;
use Term::TtyRec::Plus;

my $t = Term::TtyRec::Plus->new(
    infile => "t/nethack.ttyrec",
);
my $frame_ref;

$frame_ref = $t->grep("finger of death");
is($frame_ref->{frame}, 53, "t->grep(STRING) works");

$frame_ref = $t->grep(qr/Where do you want to jump\?/);
is($frame_ref->{frame}, 77, "t->grep(REGEX) works");

$frame_ref = $t->grep(sub { $_[0]{timestamp} > 1165798100 } );
is($frame_ref->{frame}, 339, "t->grep(SUB) works");

$frame_ref = $t->grep("priestess of Ptah", sub { $_[0]{data} !~ /\bmace\b/ });
is($frame_ref->{frame}, 364, "multiarg t->grep() works");