File: 80_failing.t

package info (click to toggle)
libmodule-extractuse-perl 0.344-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 868 kB
  • sloc: perl: 11,270; makefile: 17
file content (30 lines) | stat: -rw-r--r-- 925 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/perl -w
use strict;
#use Test::More skip_all=>'parser is known to not catch those';
use Test::More;
use Module::ExtractUse;

my @tests=
  (
   ['use base (Class::DBI,FooBar);','Class::DBI Foo::Bar'],
   ['use constant lib_ext => $Config{lib_ext};','constant'],
   [q[use Foo;say "Failed to load the release-testing modules we require Bar;";],'Foo','"require" in some string'],
   [q[eval { { use Test::Pod } use Test::Pod::Coverage }],'Test::Pod Test::Pod::Coverage','without semicolon at the end of the BLOCK'],
  );

plan tests => scalar @tests;

foreach my $t (@tests) {
    my ($code,$expected,$testname)=@$t;
    $testname ||=$code;
    my $p=Module::ExtractUse->new;
    my $used=$p->extract_use(\$code)->string;
    TODO: {
        local $TODO='known to not work';
        if ($used) {
            is($used,$expected,$testname);
        } else {
            is(undef,$expected,$testname);
        }
    }
}