File: extract-inline-tests

package info (click to toggle)
libmoose-perl 2.2207-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 7,416 kB
  • sloc: perl: 21,345; ansic: 291; makefile: 10
file content (47 lines) | stat: -rwxr-xr-x 761 bytes parent folder | download | duplicates (7)
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
#!/usr/bin/perl

use strict;
use warnings;

use File::Find::Rule;
use Getopt::Long;
use Test::Inline;

use lib 'inc';
use MyInline;

my $quiet;
GetOptions( 'quiet' => \$quiet );

my $inline = Test::Inline->new(
    verbose        => !$quiet,
    ExtractHandler => 'My::Extract',
    ContentHandler => 'My::Content',
    OutputHandler  => 'My::Output',
);

for my $pod (
    File::Find::Rule->file->name(qr/\.pod$/)->in('lib/Moose/Cookbook') ) {
    $inline->add($pod);
}

$inline->save;

{

    package My::Output;

    use Path::Tiny;

    sub write {
        my $class   = shift;
        my $name    = shift;
        my $content = shift;

        $name =~ s/^moose_cookbook_//;

        path( "t/recipes/$name" )->spew( $content );

        return 1;
    }
}