On Fri, Jan 10, 2014 at 05:35:25PM +1100, neil.lunn wrote: > On 10/01/2014 5:11 PM, Peter Rabbitson wrote: > >On Fri, Jan 10, 2014 at 04:47:56PM +1100, neil.lunn wrote: > >>On 10/01/2014 3:55 PM, Peter Rabbitson wrote: > >>Current test cases are showing an expected result of : [{ artist > >>=> { '-foo' => 1 }}] and getting a result of: [{ artist => [ { > >>'-foo' => [ 1 ] } ]}] > >I must be blind - I do not see a test like this. Please tell me which line. > Actually the first test. '-foo' => [ 1 ] appears to be the erroneous > munging of the supplied element into a list.
I feel dumber and dumber... I can't find the test you are talking about: git show 84163bb8945:t/91merge_joinpref_attr.t | grep -P '\[\s*1\s*\]' > > One more thing just from the last two tests: > > { > my $a = [ { 'artist' => 'manager' }, 'cd' ]; > my $b = [ 'artist', { 'artist' => 'manager' } ]; > my $expected = [ { 'artist' => 'manager' }, 'cd', { 'artist' => > 'manager' } ]; > my $result = $rs->_merge_joinpref_attr($a, $b); > is_deeply( $result, $expected ); > } This test is 100% correct > > { > my $a = [{ artist => [{ -join_type => 123 }, 'manager' ] }, 'cd' ]; > my $b = [{ artist => { -join_type => 123 } }, { artist => [{ > -join_type => 123 }, 'manager'] } ]; > my $expected = [ { artist => [{ -join_type => 123 }, 'manager'] }, > 'cd', { artist => [{ -join_type => 123 }, 'manager'] } ]; > my $result = $rs->_merge_joinpref_attr($a, $b); > is_deeply( $result, $expected ); > } > This one is a bit tricky but appears to be correct: $a = [ { artist_with_same_options => "manager" }, #a1 "cd", ]; $b = [ "artist_with_same_options", #b1 { artist_with_same_options => "manager" } #b2 ]; It is reasonable to expect [ { artist_with_same_options => "manager" }, # merge #a1+b1 (because option bags match, otherwise we'd throw) "cd", { artist_with_same_options => "manager" }, # b2 ] > Assuming the expected is merging *left to right* where the first > element is considered matching the existing key and the following > list element is pushed onto the list. Just trying to word out the > algorithm in order to visualize it. It is left-to-right when everything else is equal yes. _______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk