Unfortunately, is_deeply, last time I looked, doesn't properly handle
overloaded objects in the way they are meant to be handled, meaning
the tests fail. Explicitly dereferencing the return result and
wrapping it back up gets the test to pass. The goal when it came to
the tests, was to modify as little as possible to make the tests pass.
I didn't know how comfortable you would be with me rewriting all of
the tests to test for these objects. If anything, I wanted to make
sure the functionality was almost transparent. In all of the cases of
dereferencing the result and wrapping it back up, it proves that the
results obviously can be dereferenced successfully and that the
meaning of the data is still the same, which covers the majority of
the tests.
And as for breaking ref tests, I didn't break them. Obviously if it
fails to dereference, it is semantically still a failure, but I see
your point.
Now that I understand the allowed changes to the tests, I can go back
and rewrite the tests to explicitly take the POE::Data::Envelope
objects into account.
Consider this patch a shoot from the hip largely because it has been
ignored by everyone.
On Sat, Apr 19, 2008 at 2:00 AM, RCAPUTO via RT <bug-POE@rt.cpan.org> wrote:
Show quoted text>
> <URL:
http://rt.cpan.org/Ticket/Display.html?id=34779 >
>
> Hi, Nick! Now that it's the weekend, I have some time to look at your
> patch.
>
> It looks like a lot of tests have been altered to strip the blessing
> from results. Unfortunately tests like this don't test the actual data
> but rather an altered copy. I think that's bad form:
>
> is_deeply(
> - $next, [ "((($compare)))" ],
> + [@$next], [ "((($compare)))" ],
> "map filter get_one() returns ((($compare)))"
> );
>
> This is significantly better, assuming it works:
>
> is_deeply(
> - $next, [ "((($compare)))" ],
> + $next, bless([ "((($compare)))" ], 'POE::Data::Envelope'),
> "map filter get_one() returns ((($compare)))"
> );
>
> You've broken many of the ref() tests. ref([@$record]) is always equal
> to 'ARRAY' because you've wrapped the record in an arrayref! Worse,
> @$record will be a fatal error if ref($record) isn't based on ARRAY.
>
> my $records = $filter->get([ $get_request->as_string ]);
> - is(ref($records), 'ARRAY', 'simple get: get() returns list of
> requests');
> + is(ref([@$records]), 'ARRAY', 'simple get: get() returns list of
> requests');
> is(scalar(@$records), 1, 'simple get: get() returned single request');
>
> As above, I'd like to see $records tested for what it is.
>
> ... and that's all I have time for today. I'll see about the
> filter/wheel changes tomorrow.
>
--
Nicholas R. Perez