File: compare_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 (28 lines) | stat: -rw-r--r-- 948 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
use strict;
use warnings
  FATAL    => qw( all ),
  NONFATAL => qw( deprecated exec internal malloc newline once portable redefine recursion uninitialized );

use Test::Expander -tempdir => {};

my $mock_this = mock $CLASS => (
  override => [
    _show_failure => sub {},
    _show_result  => sub { !@{ shift->diag } },
  ]
);

const my $EXPECTED_FILE => path( $TEMP_DIR )->child( 'expected_file' );
const my $GOT_FILE      => path( $TEMP_DIR )->child( 'got_file' );

plan( 4 );

ok( !$METHOD_REF->( $GOT_FILE, $EXPECTED_FILE, [] ),  'invalid optional arguments' );

ok( !$METHOD_REF->( $GOT_FILE, $EXPECTED_FILE ),      'file info cannot be gathered' );

$EXPECTED_FILE->spew( 'expected_content' );
$GOT_FILE     ->spew( 'got_content' );
ok( !$METHOD_REF->( $GOT_FILE, $EXPECTED_FILE ),      'expected file passed, differences detected' );

ok( !$METHOD_REF->( $GOT_FILE, \'expected_content' ), 'expected content passed, differences detected' );