"Eric W. Biederman" <[email protected]> wrote:
> Eric Wong,
> 
> These should all of my generic patches to support my import_imap_mailbox
> script.  The really important patch that adds to the support for List-ID
> to public inbox configuration file I have already sent.
> 
> I haven't written tests and I get the following test failure when I run
> make test
> 
> > t/config.t ................. 1/? 
> > #   Failed test 'lookup matches expected output'
> > #   at t/config.t line 26.
> > #     Structures begin differing at:
> > #          $got->{listid} = ARRAY(0x55c1d4e3b6a8)
> > #     $expected->{listid} = Does not exist
> > 
> > #   Failed test 'lookup matches expected output for test'
> > #   at t/config.t line 42.
> > #     Structures begin differing at:
> > #          $got->{listid} = ARRAY(0x55c1d508d8d0)
> > #     $expected->{listid} = Does not exist
> > # Looks like you failed 2 tests of 69.
> > t/config.t ................. Dubious, test returned 2 (wstat 512, 0x200)
> 
> I haven't looked into what is happening there.

Hey Eric, I'll squash this in to fix the tests:

diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index 9f3f8df7..c2fa40f9 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -449,8 +449,10 @@ sub _fill {
                $self->{-by_addr}->{$lc_addr} = $ibx;
                $self->{-no_obfuscate}->{$lc_addr} = 1;
        }
-       foreach my $list_id (@{$ibx->{listid}}) {
-               $self->{-by_list_id}->{$list_id} = $ibx;
+       if (my $listids = $ibx->{listid}) {
+               foreach my $list_id (@$listids) {
+                       $self->{-by_list_id}->{$list_id} = $ibx;
+               }
        }
        if (my $ng = $ibx->{newsgroup}) {
                $self->{-by_newsgroup}->{$ng} = $ibx;

Perl has this weird feature where it autovivifies arrayrefs (and
hashrefs) on member access.
--
unsubscribe: [email protected]
archive: https://public-inbox.org/meta/

Reply via email to