File: ffi_checklib__exit.t

package info (click to toggle)
libffi-checklib-perl 0.31-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 504 kB
  • sloc: perl: 520; sh: 20; makefile: 2
file content (42 lines) | stat: -rw-r--r-- 893 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
37
38
39
40
41
42
use lib 't/lib';
use Test2::Require::Module 'Test2::Tools::Process';
use Test2::V0 -no_srand => 1;
use Test2::Plugin::FauxOS 'linux';
use Test2::Tools::NoteStderr qw( note_stderr );
use Test2::Tools::Process;
use FFI::CheckLib;

@$FFI::CheckLib::system_path = (
  'corpus/unix/usr/lib',
  'corpus/unix/lib',
);

subtest 'check_lib_or_exit' => sub {

  subtest 'found' => sub {
    process { check_lib_or_exit( lib => 'foo' ) } [];
  };

  subtest 'not found' => sub {
    process { note_stderr { check_lib_or_exit( lib => 'foobar') } } [
      proc_event( exit => 0 ),
    ];
  };

};

subtest 'find_lib_or_exit' => sub {

  subtest 'found' => sub {
    process { my $path = find_lib_or_exit( lib => 'foo' ) } [];
  };

  subtest 'not found' => sub {
    process { note_stderr { my $path = find_lib_or_exit( lib => 'foobar') } } [
      proc_event( exit => 0 ),
    ];
  };

};

done_testing;