From 37415497e02c3cacdd70060acddc2604342b66e5 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 7 Jan 2017 01:44:48 +0000 Subject: inbox: eliminate weaken usage entirely We can do a better job initializing the data structure so we no longer need to rely on weak references to cleanup when we ditch the config on reload. --- t/config.t | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 't/config.t') diff --git a/t/config.t b/t/config.t index 7271351b..040e9fb2 100644 --- a/t/config.t +++ b/t/config.t @@ -31,7 +31,8 @@ my $tmpdir = tempdir('pi-config-XXXXXX', TMPDIR => 1, CLEANUP => 1); -primary_address => 'meta@public-inbox.org', 'name' => 'meta', feedmax => 25, - -pi_config => $cfg, + -httpbackend_limiter => undef, + nntpserver => undef, }, "lookup matches expected output"); is($cfg->lookup('blah@example.com'), undef, @@ -48,7 +49,8 @@ my $tmpdir = tempdir('pi-config-XXXXXX', TMPDIR => 1, CLEANUP => 1); 'name' => 'test', feedmax => 25, 'url' => 'http://example.com/test', - -pi_config => $cfg, + -httpbackend_limiter => undef, + nntpserver => undef, }, "lookup matches expected output for test"); } @@ -65,4 +67,17 @@ my $tmpdir = tempdir('pi-config-XXXXXX', TMPDIR => 1, CLEANUP => 1); is_deeply($ibx->{altid}, [ @altid ]); } +{ + my $pfx = "publicinbox.test"; + my %h = ( + "$pfx.address" => 'test@example.com', + "$pfx.mainrepo" => '/path/to/non/existent', + "publicinbox.nntpserver" => 'news.example.com', + ); + my %tmp = %h; + my $cfg = PublicInbox::Config->new(\%tmp); + my $ibx = $cfg->lookup_name('test'); + is($ibx->{nntpserver}, 'news.example.com', 'global NNTP server'); +} + done_testing(); -- cgit v1.2.3-24-ge0c7