App-Pod

 view release on metacpan or  search on metacpan

t/01-usage-simple.t  view on Meta::CPAN

            q{ (bool},
            q( BEGIN),
            q( EXPORT),
            q( EXPORT_OK),
            q( ISA),
            q( VERSION),
            q( __ANON__),
            q( abs2rel),
            q( basename              - Return the last level of t ...),
            q( canonpath),
            q( catfile),
            q( child                 - Return a new Mojo::File ob ...),
            q( chmod                 - Change file permissions.),
            q( copy),
            q( copy_to               - Copy file with File::Copy  ...),
            q( croak),
            q( curfile               - Construct a new scalar-bas ...),
            q( dirname               - Return all but the last le ...),
            q( extname               - Return file extension of t ...),
            q( file_name_is_absolute),
            q( find),
            q( getcwd),
            q( import),
            q( is_abs                - Check if the path is absolute.),
            q( list                  - List all files in the dire ...),
            q( list_tree             - List all files recursively ...),
            q( lstat                 - Return a File::stat object ...),
            q( make_path             - Create the directories if  ...),
            q( move),
            q( move_to               - Move file with File::Copy  ...),
            q( new                   - Construct a new Mojo::File ...),
            q( open                  - Open file with IO::File.),
            q( path                  - Construct a new scalar-bas ...),
            q( realpath              - Resolve the path with Cwd  ...),
            q( rel2abs),
            q( remove                - Delete file.),
            q( remove_tree           - Delete this directory and  ...),
            q( sibling               - Return a new Mojo::File ob ...),
            q( slurp                 - Read all data at once from ...),
            q( splitdir),
            q( spurt                 - Write all data at once to  ...),
            q( stat                  - Return a File::stat object ...),
            q( tap                   - Alias for "tap" in Mojo::Base.),
            q( tempdir               - Construct a new scalar-bas ...),
            q( tempfile              - Construct a new scalar-bas ...),
            q( to_abs                - Return absolute path as a  ...),
            q( to_array              - Split the path on director ...),
            q( to_rel                - Return a relative path fro ...),
            q( to_string             - Stringify the path.),
            q( touch                 - Create file if it does not ...),
            q( with_roles            - Alias for "with_roles" in  ...),
        ],
    },
);

my $is_path       = qr/ ^ Path: \s* \K (.*) $ /x;
my $is_version    = qr/ \b \d+\.\d+  $ /x;
my $is_cache_path = qr/ "_cache_path" \s+ => \K \s+ ".*" /x;

for my $case ( @cases ) {
    local @ARGV = ( $case->{input}->@* );
    my $input = "@ARGV";
    my $out   = "";

    # Capture output.
    {
        local *STDOUT;
        local *STDERR;
        open STDOUT, ">",  \$out or die $!;
        open STDERR, ">>", \$out or die $!;
        eval { App::Pod->run };
        if ( $@ ) {
            $out = $@;
            chomp $out;
        }
    }

    my @lines = split /\n/, colorstrip( $out // '' );

    # Normalize PATHs
    for ( @lines ) {
        s/$is_path/<PATH>/;
        s/$is_cache_path/ "PATH"/g;
    }

    # Normalize Version
    if ( "$input" eq "--version" ) {
        $lines[0] =~ s/$is_version/<VERSION>/;
    }

    say STDERR _dumper \@lines
      and last
      unless is_deeply( \@lines, $case->{expected_output}, $case->{name} );
}

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.794 second using v1.00-cache-2.02-grep-82fe00e-cpan-9e6bc14194b )