Bio-Protease

 view release on metacpan or  search on metacpan

t/specificity-regex.t  view on Meta::CPAN

use Modern::Perl;
use Test::Exception;
use Test::More;

{
    package My::Protease;
    use Moose;

    with qw(Bio::ProteaseI Bio::Protease::Role::Specificity::Regex);

    has '+regex' => ( init_arg => 'specificity' );
    has 'specificity' => ( is => 'ro', default => 'regex', init_arg => undef );
}

my $p;

lives_ok { $p = My::Protease->new( specificity => qr/AAA.{5}/ ) };

is_deeply( $p->regex, [ qr/AAA.{5}/ ] );

ok $p->cut('AAACCCCC', 4);

is_deeply( [ $p->digest( 'AAACCCCC' ) ], [ 'AAAC', 'CCCC' ] );

dies_ok { $p = My::Protease->new( specificity => 'foo' ) };

done_testing();

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

( run in 0.414 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )