File: dir_only_contains_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 (22 lines) | stat: -rw-r--r-- 620 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use strict;
use warnings
  FATAL    => qw( all ),
  NONFATAL => qw( deprecated exec internal malloc newline once portable redefine recursion uninitialized );

use Test::Expander;

my $mockThis = mock $CLASS => (
  override => [
    _dir_contains_ok        => sub {},
    _show_failure           => sub {},
    _show_result            => sub { 1 },
    _validate_trailing_args => sub { shift },
  ],
);

plan( 2 );

ok(  $METHOD_REF->( 'dir', [ 'file' ] ), 'comparison performed' );

$mockThis->override( diag => sub { [ 'ERROR' ] } );
ok( !$METHOD_REF->( 'dir', [ 'file' ] ), 'invalid arguments, comparison rejected' );