File: compare_dirs_ok.t

package info (click to toggle)
libtest-files-perl 0.26-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 352 kB
  • sloc: perl: 406; makefile: 7
file content (34 lines) | stat: -rw-r--r-- 792 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
use strict;
use warnings
  FATAL    => qw( all ),
  NONFATAL => qw( deprecated exec internal malloc newline once portable redefine recursion uninitialized );

use Test::Expander;

plan( 2 );

subtest success => sub {
  plan( 2 );

  my $mock_this = mock $CLASS => (
    override => [
      _compare_dirs           => sub { pass( 'compared' ) },
      _validate_trailing_args => sub { shift },
    ]
  );

  lives_ok { $METHOD_REF->( 'first_dir', 'second_dir' ) } 'executed';
};

subtest failure => sub {
  plan( 2 );

  my $mock_this = mock $CLASS => (
    override => [
      _show_failure           => sub { pass( 'error detected' ) },
      _validate_trailing_args => sub { shift->diag( [ 'ERROR' ] ) },
    ]
  );

  lives_ok { $METHOD_REF->( 'first_dir', 'second_dir' ) } 'executed';
};