File: 70-session.t

package info (click to toggle)
libtest-valgrind-perl 1.19-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 424 kB
  • sloc: perl: 2,779; makefile: 22
file content (56 lines) | stat: -rw-r--r-- 1,445 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!perl

use strict;
use warnings;

BEGIN { delete $ENV{PATH} }

use Test::Valgrind::Session;

use Test::More tests => 7;

use lib 't/lib';
use Test::Valgrind::FakeValgrind;

my $sess = eval { Test::Valgrind::Session->new(
 search_dirs => [ ],
) };
like $@, qr/^Empty valgrind candidates list/, 'no search_dirs';

$sess = eval { Test::Valgrind::Session->new(
 valgrind => 'wut',
) };
like $@, qr/^No appropriate valgrind executable/, 'nonexistant valgrind';

SKIP: {
 my $old_vg = Test::Valgrind::FakeValgrind->new(
  version => '3.0.0',
 );
 skip $old_vg => 5 unless ref $old_vg;

 my $sess = eval { Test::Valgrind::Session->new(
  valgrind    => $old_vg->path,
  min_version => '3.1.0',
 ) };
 like $@, qr/^No appropriate valgrind executable/, 'old valgrind';

 my $new_vg = Test::Valgrind::FakeValgrind->new(
  version => '3.4.0',
 );
 skip $new_vg => 4 unless ref $new_vg;

 $sess = eval { Test::Valgrind::Session->new(
  valgrind    => $new_vg->path,
  min_version => '3.1.0',
 ) };
 is     $@,    '',                        'new valgrind';
 isa_ok $sess, 'Test::Valgrind::Session', 'new valgrind isa Test::Valgrind::Session';

 $sess = eval { Test::Valgrind::Session->new(
  search_dirs => [ ],
  valgrind    => [ $old_vg->path, $new_vg->path ],
  min_version => '3.1.0',
 ) };
 is     $@,    '',                        'old and new valgrind';
 isa_ok $sess, 'Test::Valgrind::Session', 'old and new valgrind isa Test::Valgrind::Session';
}