Skip Menu |
 

This queue is for tickets about the Test-Deep-UnorderedPairs CPAN distribution.

Report information
The Basics
Id: 85470
Status: resolved
Priority: 0/
Queue: Test-Deep-UnorderedPairs

People
Owner: Nobody in particular
Requestors: mail [...] tobyinkster.co.uk
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Download (untitled) / with headers
text/plain 340b
While Test-Deep-UnorderedPairs seems like it would be useful for some purposes, I'm not sure it would always be useful for the example given in the SYNOPSIS - comparing PSGI responses. The reason being that PSGI header arrayrefs allow repetition: [ Set_Cookie => q[foo='1'; path="/"], Set_Cookie => q[bar='2'; path="/"], ]
Perhaps an additional function could be provided that allowed repeated keys.
Subject: Re: [rt.cpan.org #85470] Disallows repetition within the "keys"
Date: Mon, 20 May 2013 09:42:15 -0700
To: Toby Inkster via RT <bug-Test-Deep-UnorderedPairs [...] rt.cpan.org>
From: Karen Etheridge <ether [...] cpan.org>
Download (untitled) / with headers
text/plain 435b
On Mon, May 20, 2013 at 12:38:36PM -0400, Toby Inkster via RT wrote: Show quoted text
> Queue: Test-Deep-UnorderedPairs > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=85470 > > > Perhaps an additional function could be provided that allowed repeated keys.
Agreed, the current implementation would only work if there are no duplicate keys. I'll leave this ticket open while I ponder how to implement what is quite a valid usecase.
Download (untitled) / with headers
text/plain 301b
The easiest implementation I can see would be to map: [ foo => 3, foo => 2, bar => 1, ] to: [ foo => [3, 2], bar => [1], ] then sort those arrayrefs: [ foo => [2, 3], bar => [1], ] ... and you should be able to do a normal deep comparison.
Subject: Re: [rt.cpan.org #85470] Disallows repetition within the "keys"
Date: Mon, 20 May 2013 15:40:26 -0700
To: Toby Inkster via RT <bug-Test-Deep-UnorderedPairs [...] rt.cpan.org>
From: Karen Etheridge <ether [...] cpan.org>
Download (untitled) / with headers
text/plain 437b
On Mon, May 20, 2013 at 05:16:05PM -0400, Toby Inkster via RT wrote: Show quoted text
> then sort those arrayrefs: > > [ > foo => [2, 3], > bar => [1], > ] > > ... and you should be able to do a normal deep comparison.
Doing the comparisons is not difficult - one can even do the comparison like all(bag(pair), bag(pair), ...) -- the trick is getting the diagnostics to look sane on failure. That's why a custom descender is needed.
Fixed in v0.003.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.