Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add a few more annotation classes with simple tests
  • Loading branch information
cjfields committed Dec 29, 2015
1 parent 0b80b50 commit 32f05f2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/Bio/Annotation/DBLink.pm6
Expand Up @@ -4,7 +4,7 @@ use Bio::Role::Annotation;
use Bio::Role::Identifiable;

class Bio::Annotation::DBLink does Bio::Role::Annotation
does Bio::Role::Identifiable {
does Bio::Role::Identifiable {

has Str $.database is rw;

Expand All @@ -26,10 +26,10 @@ class Bio::Annotation::DBLink does Bio::Role::Annotation
method hash-tree(){ ... }

method Str() {
return "Direct database link to " ~ .$.primary-id
~ ($.version ?? "." ~ $.version !! "" )
~ ($.optional-id ?? " (" ~ $.optional-id ~ ")" !! "" )
~ " in database " ~ $.database;
return "Direct database link to " ~ $.primary-id
~ ($.version ?? "." ~ $.version !! "" )
~ ($.optional-id ?? " (" ~ $.optional-id ~ ")" !! "" )
~ " in database " ~ $.database;
}

}
13 changes: 13 additions & 0 deletions t/Annotation/Comment.t
@@ -0,0 +1,13 @@
use v6;

use lib './lib';
use Test;

use Bio::Annotation::Comment;

my $comment = Bio::Annotation::Comment.new( text => 'sometext');
does-ok($comment, Bio::Role::Annotation);
is $comment.text, 'sometext';
is ~$comment, 'Comment: sometext';

done-testing();
18 changes: 18 additions & 0 deletions t/Annotation/DBLink.t
@@ -0,0 +1,18 @@
use v6;

use lib './lib';
use Test;

use Bio::Annotation::DBLink;

my $link1 = Bio::Annotation::DBLink.new(database => 'TSC',
primary-id => 'TSC0000030',
);
does-ok($link1, Bio::Role::Annotation);
does-ok($link1, Bio::Role::Identifiable);

is $link1.database, 'TSC';
is $link1.primary-id, 'TSC0000030';
is ~$link1, 'Direct database link to TSC0000030 in database TSC';

done-testing();

0 comments on commit 32f05f2

Please sign in to comment.