File: method-check.t

package info (click to toggle)
librun-parts-perl 0.09-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 196 kB
  • ctags: 20
  • sloc: perl: 409; makefile: 4; sh: 4
file content (36 lines) | stat: -rw-r--r-- 916 bytes parent folder | download
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
#!perl -T

use strict;
use warnings;
use 5.010;

use Test::More;
use Test::Trap;
use Test::Differences;

delete @ENV{qw{PATH ENV IFS CDPATH BASH_ENV}};

my $d = 't/basic-dummy';
our $trap;

use_ok( 'Run::Parts' );

my @rc = trap { die "foo" };
$trap->did_die('Expecting foo to die' );
is ( $trap->stdout, '', 'Expecting no STDOUT' );
$trap->die_like(qr/foo/, "Argues about foo");

my $rp = Run::Parts->new($d);
my @r = trap { $rp->lines("foo\n", "bar\n"); };
$trap->did_die('Expecting lines to die' );
is ( $trap->stdout, '', 'Expecting no STDOUT' );
$trap->die_like(qr/lines is no method/,
       "Warn's about lines not being a method");

@r = trap { $rp->chomped_lines("foo\n", "bar\n"); };
$trap->did_die('Expecting chomped_lines to die' );
is ( $trap->stdout, '', 'Expecting no STDOUT' );
$trap->die_like(qr/chomped_lines is no method/,
       "Warn's about chomped_lines not being a method");

done_testing();