File: test_alien_canplatypus.t

package info (click to toggle)
libalien-build-perl 2.84-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,116 kB
  • sloc: perl: 10,350; ansic: 134; sh: 66; makefile: 2
file content (53 lines) | stat: -rw-r--r-- 1,072 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
43
44
45
46
47
48
49
50
51
52
53
use 5.008004;
use Test2::V0 -no_srand => 1;
use Test::Alien::CanPlatypus ();
use ExtUtils::CBuilder;

subtest 'skip/import' => sub {

  subtest 'have platypus' => sub {

    local $INC{'FFI/Platypus.pm'} = __FILE__;

    is
      [Test::Alien::CanPlatypus->skip],
      [F()],
      'skip'
    ;
    is
      intercept { Test::Alien::CanPlatypus->import },
      [],
      'import',
    ;
  };

  subtest 'no platypus' => sub {

    $Devel::Hide::VERBOSE =
    $Devel::Hide::VERBOSE = 0;
    skip_all 'test does not work on Perl 5.8' unless $] >= 5.010;
    skip_all 'subtest requires Devel::Hide' unless eval { require Devel::Hide };
    Devel::Hide->import( 'FFI::Platypus' );

    is
      [Test::Alien::CanPlatypus->skip],
      ['This test requires FFI::Platypus.'],
      'skip'
    ;
    is
      intercept { Test::Alien::CanPlatypus->import },
      array {
        event Plan => sub {
          call directive => 'SKIP';
          call reason => 'This test requires FFI::Platypus.';
        };
        end;
      },
      'import',
    ;

  };

};

done_testing;