App-Anchr

 view release on metacpan or  search on metacpan

t/01-commands.t  view on Meta::CPAN

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(commands )] );

like(
    $result->stdout,
    qr{list the application's commands},
    'default commands outputs'
);

is( $result->stderr, '', 'nothing sent to sderr' );

is( $result->error, undef, 'threw no exceptions' );

done_testing(3);

t/07-overlap.t  view on Meta::CPAN

my $result = test_app( 'App::Anchr' => [qw(help overlap)] );
like( $result->stdout, qr{overlap}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(overlap)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(overlap t/1_4.pac.fasta t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app( 'App::Anchr' => [qw(overlap t/1_4.pac.fasta -v -o stdout)] );
is( ( scalar grep {/^CMD/} grep {/\S/} split( /\n/, $result->stderr ) ), 5, 'stderr line count' );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 14, 'line count' );
like( $result->stdout, qr{overlap}s, 'overlaps' );
like( $result->stdout, qr{pac4745_7148}s, 'original names' );

$result = test_app( 'App::Anchr' => [qw(overlap t/1_4.pac.fasta --idt 0.8 --len 2500 --serial -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 4, 'line count' );
unlike( $result->stdout, qr{pac4745_7148}s, 'serials' );

$result = test_app( 'App::Anchr' => [qw(overlap t/1_4.pac.fasta --idt 0.8 --len 2500 --all -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 36, 'line count' );

t/09-orient.t  view on Meta::CPAN


$result = test_app( 'App::Anchr' => [qw(orient t/1_4.pac.fasta t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app(
    'App::Anchr' => [qw(orient t/1_4.anchor.fasta t/1_4.pac.fasta -r t/not_exists -o stdout)] );
like( $result->error, qr{doesn't exist}, 'restrict file not exists' );

$result = test_app( 'App::Anchr' =>
        [qw(orient t/1_4.anchor.fasta t/1_4.pac.fasta -r t/1_4.2.restrict.tsv -v -o stdout)] );
is( ( scalar grep {/^CMD/} grep {/\S/} split( /\n/, $result->stderr ) ), 9, 'stderr line count' );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 24, 'line count' );
like( $result->stdout, qr{pac4745_7148}s, 'original names' );

done_testing();

t/14-contained.t  view on Meta::CPAN

my $result = test_app( 'App::Anchr' => [qw(help contained)] );
like( $result->stdout, qr{contained}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(contained)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(contained t/1_4.pac.fasta t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app( 'App::Anchr' => [qw(contained t/1_4.anchor.fasta --prefix anchor -v -o stdout)] );
is( ( scalar grep {/^CMD/} grep {/\S/} split( /\n/, $result->stderr ) ), 3, 'stderr line count' );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 8, 'line count' );
unlike( $result->stdout, qr{anchor576_1624}s, 'original names' );
like( $result->stdout, qr{anchor_0\/1\/}s, 'renamed' );

$result = test_app( 'App::Anchr' => [qw(contained t/contained.fasta -v -o stdout)] );
is( ( scalar grep {/^CMD/} grep {/\S/} split( /\n/, $result->stderr ) ), 3, 'stderr line count' );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 2, 'line count' );
like( $result->stdout, qr{infile_0\/}s, 'renamed' );

done_testing();

t/15-merge.t  view on Meta::CPAN

my $result = test_app( 'App::Anchr' => [qw(help merge)] );
like( $result->stdout, qr{merge}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(merge)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(merge t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app( 'App::Anchr' => [qw(merge t/merge.fasta -v -o stdout)] );
is( ( scalar grep {/^CMD/} grep {/\S/} split( /\n/, $result->stderr ) ), 3, 'stderr line count' );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 2, 'line count' );
like( $result->stdout, qr{merge_1}s, 'merged' );

done_testing();

t/16-layout.t  view on Meta::CPAN

{
    my $tempdir = Path::Tiny->tempdir;
    $result = test_app(
        'App::Anchr' => [
            qw(layout t/24_4.ovlp.tsv t/24_4.relation.tsv t/24_4.strand.fasta),
            qw(--oa t/24_4.anchor.ovlp.tsv -o),
            $tempdir->child('conTig.fasta'),
        ]
    );
    is( $result->error, undef, 'no exceptions' );
    is( ( scalar grep {/\S/} split( /\n/, $result->stderr ) ), 1, 'stderr line count' );
    is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 0, 'line count' );

    ok( $tempdir->child("conTig.fasta")->is_file, 'outfile exists' );

    is( scalar $tempdir->child("conTig.fasta")->lines, 2, 'line count' );
}

done_testing();

t/23-trimlong.t  view on Meta::CPAN

my $result = test_app( 'App::Anchr' => [qw(help trimlong)] );
like( $result->stdout, qr{trimlong}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(trimlong)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(trimlong t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app( 'App::Anchr' => [qw(trimlong t/1_4.pac.fasta -v -o stdout)] );
is( ( scalar grep {/^CMD/} grep {/\S/} split( /\n/, $result->stderr ) ), 3, 'stderr line count' );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 16, 'line count' );
like( $result->stdout, qr{pac4745_7148}s, 'original names' );
unlike( $result->stdout, qr{pac4745_7148:1}s, 'uncovered region' );

$result = test_app(
    'App::Anchr' => [
        qw(trimlong t/1_4.pac.fasta -v -o stdout),
        "--jvm", "'-d64 -server'"
    ]
);
is( ( scalar grep {/^CMD/} grep {/\S/} split( /\n/, $result->stderr ) ), 3, 'stderr line count' );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 16, 'line count' );
like( $result->stderr, qr{jar-with-dependencies}s, 'path of jrange jar' );

done_testing();



( run in 1.256 second using v1.01-cache-2.11-cpan-49f99fa48dc )