Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl
Commits
35f3ef5c
Commit
35f3ef5c
authored
12 years ago
by
Andy Yates
Browse files
Options
Downloads
Patches
Plain Diff
Already have this in the ensembl-test package. no need for it here
parent
a8fb325e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/t/TestUtils.pm
+0
-69
0 additions, 69 deletions
modules/t/TestUtils.pm
with
0 additions
and
69 deletions
modules/t/TestUtils.pm
deleted
100644 → 0
+
0
−
69
View file @
a8fb325e
use
strict
;
package
TestUtils
;
require
Exporter
;
use
vars
qw( @ISA @EXPORT_OK )
;
@ISA
=
('
Exporter
');
@EXPORT_OK
=
qw(&debug &test_getter_setter &count_rows)
;
=head2 test_getter_setter
Arg [1] : Object $object
The object to test the getter setter on
Arg [2] : string $method
The name of the getter setter method to test
Arg [3] : $test_val
The value to use to test the set behavior of the method.
Example : ok(&TestUtils::test_getter_setter($object, 'type', 'value'));
Description: Tests a getter setter method by attempting to set a value
and verifying that the newly set value can be retrieved. The
old value of the the attribute is restored after the test
(providing the method functions correctly).
Returntype : boolean - true value on success, false on failure
Exceptions : none
Caller : test scripts
=cut
sub
test_getter_setter
{
my
(
$object
,
$method
,
$test_val
)
=
@_
;
my
$ret_val
=
0
;
#save the old value
my
$old_val
=
$object
->
$method
;
$object
->
$method
(
$test_val
);
#verify value was set
$ret_val
=
(
!
defined
(
$test_val
)
&&
!
defined
(
$object
->
$method
))
||
(
$object
->
$method
eq
$test_val
);
#restore the old value
$object
->
$method
(
$old_val
);
return
$ret_val
;
}
sub
debug
{
if
(
$
::
verbose
)
{
print
STDERR
@
_
,"
\n
";
}
}
sub
count_rows
{
my
$db
=
shift
;
my
$tablename
=
shift
;
my
$sth
=
$db
->
prepare
(
"
select count(*) from
$tablename
"
);
$sth
->
execute
();
my
(
$count
)
=
$sth
->
fetchrow_array
();
return
$count
;
}
1
;
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment