File: _export_most_symbols.t

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

use Test::Expander   -tempfile => {};
use Scalar::Readonly qw( readonly_off );

my $mockThis = mock $CLASS => ( override => [ _export_symbols => sub {} ] );

plan( 2 );

readonly_off( $Test::Expander::TEST_FILE );

subtest 'test file exists' => sub {
  plan( 2 );

  lives_ok { $METHOD_REF->( $TEMP_FILE ) }    'executed';
  is( $Test::Expander::TEST_FILE, $TEMP_FILE, q('$TEMP_FILE' set) );
};

subtest 'test file does not exist' => sub {
  plan( 2 );

  path( $TEMP_FILE )->remove;
  $Test::Expander::TEST_FILE = '';

  lives_ok { $METHOD_REF->( $TEMP_FILE ) } 'executed';
  is( $Test::Expander::TEST_FILE, '',      q('$TEMP_FILE' not set) );
};