From 8cf11593893e62a05ccb168e116de7e994fb75bc Mon Sep 17 00:00:00 2001 From: Magali Ruffier <mr6@ebi.ac.uk> Date: Wed, 9 Jan 2013 09:45:49 +0000 Subject: [PATCH] added test cases for undefined objects --- modules/t/attributeAdaptor.t | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/modules/t/attributeAdaptor.t b/modules/t/attributeAdaptor.t index 92c085a276..d168b80ec9 100644 --- a/modules/t/attributeAdaptor.t +++ b/modules/t/attributeAdaptor.t @@ -7,7 +7,8 @@ use Test::More; use Bio::EnsEMBL::Test::MultiTestDB; use Bio::EnsEMBL::Attribute; -our $verbose = 0; +our $verbose = 1; +our $clean = 0; my $multi = Bio::EnsEMBL::Test::MultiTestDB->new; @@ -75,6 +76,17 @@ ok($attrib->code eq 'test_code'); ok($attrib->description eq 'test_desc'); ok($attrib->value eq 'test_value'); +@attribs = @{ $aa->fetch_all_by_MiscFeature() }; + +ok(@attribs == 1); + +$attrib = $attribs[0]; + +ok($attrib->name eq 'test_name'); +ok($attrib->code eq 'test_code'); +ok($attrib->description eq 'test_desc'); +ok($attrib->value eq 'test_value'); + # # test the removal of this attribute @@ -98,6 +110,7 @@ ok(@attribs == 0); + ################# # Slice functionality tests # @@ -134,16 +147,16 @@ ok($count == 1); # test that we can now retrieve this attribute # @attribs = @{$aa->fetch_all_by_Slice($slice)}; - ok(@attribs == 1); - @attribs = @{$aa->fetch_all_by_Slice($slice,"rubbish")}; ok(@attribs == 0); @attribs = @{$aa->fetch_all_by_Slice($slice,"test_code2")}; ok(@attribs == 1); +@attribs = @{$aa->fetch_all_by_Slice(undef,"test_code2")}; +ok(@attribs == 1); $attrib = $attribs[0]; @@ -213,6 +226,10 @@ ok($count == 1); note "attribs: " . scalar(@attribs); ok(@attribs == 1); +@attribs = @{$aa->fetch_all_by_Slice(undef)}; +ok(@attribs == 1); + + # # test the removal of this attribute -- GitLab