Moose Bug Test Fixer
A quick postette day may-by here in the Moose-Pen
Well I though I would have a very quick post here today, which is nice as I am still not 100%. I was going to re-run my test-suite end to end and you would think with only '
2 files changed, 37 insertions(+), 9 deletions(-)
in Database::Accessor there is not much that could go wrong.
First I had these annoying warings again;
Use of uninitialized value in string ne at /home/scolesj/databaselib/Database/Accessor.pm line 479.
After little poking about I seen that I had to include a check to see if indeed there is an alias on the view. I added in this patch;
if (($field->view)
and ($field->view ne $self->view()->name()
-- and $field->view ne $self->view()->alias()));
++ and ($self->view()->alias() and ($field->view ne $self->view()->alias()))));
and now I do not get that warning;
The next one was a little more problematic;
t/20_dad_load.t ............. 1/67
# Failed test 'Processed Container drops key!'
# at t/20_dad_load.t line 107.
# Comparing hash keys of $data
# Extra: 'dad_fiddle'
After a considerable time working on this bug, much more than should go into a simple test class I found my mistake; I simply was returning the @process_array vs the @return_container and this little patch cleaned that up;
if ($in_hash_class){
-- return shift(@process_array);
++ return shift(@return_container);
}
else{
-- return \@process_array;
++ return \@return_container;
}
After a checking an push on my part I did a pull and this was the result of that
4 files changed, 8 insertions(+), 8 deletions(-)
and on test I get this fail;
# Failed test 'Container drops street and phone on create'
# at t/50_create.t line 102.
so fix one break another
in the end that one was back at that alias code again and I had to change the logic ever so slightly
-- if (($field->view)
-- and ($field->view ne $self->view()->name()
-- and ($self->view()->alias() and ($field->view ne $self->view()->alias()))));
++ if ((($field->view)
++ and ($field->view ne $self->view()->name())
++ or ($self->view()->alias() and ($field->view ne $self->view()->alias()))));
and now I get
t/test.t .................... ok
All tests successful.
Files=29, Tests=507,
for both Database::Accesssor and Driver::DBI
Not a log post but it did take hell over two hours just to track down these little bugs so just as long time wise as many longer posts.
However I am still not happy with the trim of my jib. My Test::Driver is getting and the logic for that alias has grown into a real monster. Well maybe something for tomorrow;
Leave a comment