about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/imapd.t4
-rw-r--r--t/inbox_idle.t8
-rw-r--r--t/mda_filter_rubylang.t4
-rw-r--r--t/nntp.t2
-rw-r--r--t/psgi_mount.t6
-rw-r--r--t/psgi_search.t6
-rw-r--r--t/psgi_v2.t11
-rw-r--r--t/watch_filter_rubylang.t10
-rw-r--r--t/watch_maildir.t26
-rw-r--r--t/watch_maildir_v2.t48
-rw-r--r--t/watch_multiple_headers.t8
11 files changed, 66 insertions, 67 deletions
diff --git a/t/imapd.t b/t/imapd.t
index c1c52839..43ec200c 100644
--- a/t/imapd.t
+++ b/t/imapd.t
@@ -251,8 +251,8 @@ ok($mic->logout, 'logout works');
 
 my $have_inotify = eval { require Linux::Inotify2; 1 };
 
-my $pi_config = PublicInbox::Config->new;
-$pi_config->each_inbox(sub {
+my $pi_cfg = PublicInbox::Config->new;
+$pi_cfg->each_inbox(sub {
         my ($ibx) = @_;
         my $env = { ORIGINAL_RECIPIENT => $ibx->{-primary_address} };
         my $name = $ibx->{name};
diff --git a/t/inbox_idle.t b/t/inbox_idle.t
index e16ee11b..198856bd 100644
--- a/t/inbox_idle.t
+++ b/t/inbox_idle.t
@@ -32,14 +32,14 @@ for my $V (1, 2) {
                 $sidx->set_metadata_once;
                 $sidx->idx_release; # allow watching on lockfile
         }
-        my $pi_config = PublicInbox::Config->new(\<<EOF);
+        my $pi_cfg = PublicInbox::Config->new(\<<EOF);
 publicinbox.inbox-idle.inboxdir=$inboxdir
 publicinbox.inbox-idle.indexlevel=basic
 publicinbox.inbox-idle.address=test\@example.com
 EOF
         my $ident = 'whatever';
-        $pi_config->each_inbox(sub { shift->subscribe_unlock($ident, $obj) });
-        my $ii = PublicInbox::InboxIdle->new($pi_config);
+        $pi_cfg->each_inbox(sub { shift->subscribe_unlock($ident, $obj) });
+        my $ii = PublicInbox::InboxIdle->new($pi_cfg);
         ok($ii, 'InboxIdle created');
         SKIP: {
                 skip('inotify or kqueue missing', 1) unless $ii->{sock};
@@ -50,7 +50,7 @@ EOF
         PublicInbox::SearchIdx->new($ibx)->index_sync if $V == 1;
         $ii->event_step;
         is(scalar @{$obj->{called}}, 1, 'called on unlock');
-        $pi_config->each_inbox(sub { shift->unsubscribe_unlock($ident) });
+        $pi_cfg->each_inbox(sub { shift->unsubscribe_unlock($ident) });
         ok($im->add(eml_load('t/data/0001.patch')), "$V added #2");
         $im->done;
         PublicInbox::SearchIdx->new($ibx)->index_sync if $V == 1;
diff --git a/t/mda_filter_rubylang.t b/t/mda_filter_rubylang.t
index 754d52f7..489ea223 100644
--- a/t/mda_filter_rubylang.t
+++ b/t/mda_filter_rubylang.t
@@ -44,8 +44,8 @@ something
 EOF
                 ok(run_script(['-mda'], $env, $opt), 'message delivered');
         }
-        my $config = PublicInbox::Config->new;
-        my $ibx = $config->lookup_name($v);
+        my $cfg = PublicInbox::Config->new;
+        my $ibx = $cfg->lookup_name($v);
 
         # make sure all serials are searchable:
         for my $i (1..2) {
diff --git a/t/nntp.t b/t/nntp.t
index 3d2f524c..b745886d 100644
--- a/t/nntp.t
+++ b/t/nntp.t
@@ -113,7 +113,7 @@ use PublicInbox::Config;
         my $mock_self = {
                 nntpd => {
                         servername => 'example.com',
-                        pi_config => bless {}, 'PublicInbox::Config',
+                        pi_cfg => bless {}, 'PublicInbox::Config',
                 },
                 ibx => $ibx,
         };
diff --git a/t/psgi_mount.t b/t/psgi_mount.t
index b4de8274..dac62c1a 100644
--- a/t/psgi_mount.t
+++ b/t/psgi_mount.t
@@ -17,7 +17,7 @@ use_ok 'PublicInbox::WWW';
 use PublicInbox::Import;
 use PublicInbox::Git;
 use PublicInbox::Config;
-my $config = PublicInbox::Config->new(\<<EOF);
+my $cfg = PublicInbox::Config->new(\<<EOF);
 $cfgpfx.address=$addr
 $cfgpfx.inboxdir=$maindir
 EOF
@@ -39,7 +39,7 @@ EOF
         $im->done;
 }
 
-my $www = PublicInbox::WWW->new($config);
+my $www = PublicInbox::WWW->new($cfg);
 my $app = builder(sub {
         enable('Head');
         mount('/a' => builder(sub { sub { $www->call(@_) } }));
@@ -85,7 +85,7 @@ test_psgi($app, sub {
 
 SKIP: {
         require_mods(qw(DBD::SQLite Search::Xapian IO::Uncompress::Gunzip), 3);
-        my $ibx = $config->lookup_name('test');
+        my $ibx = $cfg->lookup_name('test');
         require_ok 'PublicInbox::SearchIdx';
         PublicInbox::SearchIdx->new($ibx, 1)->index_sync;
         test_psgi($app, sub {
diff --git a/t/psgi_search.t b/t/psgi_search.t
index c1677eb3..07fb4846 100644
--- a/t/psgi_search.t
+++ b/t/psgi_search.t
@@ -67,11 +67,11 @@ $im->done;
 PublicInbox::SearchIdx->new($ibx, 1)->index_sync;
 
 my $cfgpfx = "publicinbox.test";
-my $config = PublicInbox::Config->new(\<<EOF);
+my $cfg = PublicInbox::Config->new(\<<EOF);
 $cfgpfx.address=git\@vger.kernel.org
 $cfgpfx.inboxdir=$tmpdir
 EOF
-my $www = PublicInbox::WWW->new($config);
+my $www = PublicInbox::WWW->new($cfg);
 test_psgi(sub { $www->call(@_) }, sub {
         my ($cb) = @_;
         my $res;
@@ -144,7 +144,7 @@ test_psgi(sub { $www->call(@_) }, sub {
                 $xdb->set_metadata('has_threadid', '0');
                 $sidx->idx_release;
         }
-        $config->each_inbox(sub { delete $_[0]->{search} });
+        $cfg->each_inbox(sub { delete $_[0]->{search} });
         $res = $cb->(GET('/test/?q=s:test'));
         is($res->code, 200, 'successful search w/o has_threadid');
         unlike($html, qr/download mbox\.gz: .*?"full threads"/s,
diff --git a/t/psgi_v2.t b/t/psgi_v2.t
index 11aef5b3..0ceb26ed 100644
--- a/t/psgi_v2.t
+++ b/t/psgi_v2.t
@@ -83,12 +83,11 @@ like($$msg, qr/\AFrom oldbug/s,
         '"From_" line stored to test old bug workaround');
 
 my $cfgpfx = "publicinbox.v2test";
-my $cfg = <<EOF;
+my $cfg = PublicInbox::Config->new(\<<EOF);
 $cfgpfx.address=$ibx->{-primary_address}
 $cfgpfx.inboxdir=$inboxdir
 EOF
-my $config = PublicInbox::Config->new(\$cfg);
-my $www = PublicInbox::WWW->new($config);
+my $www = PublicInbox::WWW->new($cfg);
 my ($res, $raw, @from_);
 my $client0 = sub {
         my ($cb) = @_;
@@ -150,7 +149,7 @@ my $client1 = sub {
         like($raw, qr/^hello ghosts$/m, 'got third message');
         @from_ = ($raw =~ m/^From /mg);
         is(scalar(@from_), 3, 'three From_ lines');
-        $config->each_inbox(sub { $_[0]->search->reopen });
+        $cfg->each_inbox(sub { $_[0]->search->reopen });
 
         SKIP: {
                 eval { require IO::Uncompress::Gunzip };
@@ -240,7 +239,7 @@ $run_httpd->($client1, 38);
         $im->done;
         my @h = $mime->header('Message-ID');
         is_deeply($exp, \@h, 'reused existing Message-ID');
-        $config->each_inbox(sub { $_[0]->search->reopen });
+        $cfg->each_inbox(sub { $_[0]->search->reopen });
 }
 
 my $client2 = sub {
@@ -279,7 +278,7 @@ $run_httpd->($client2, 8);
                 ok($im->add($mime), "added attachment $body");
         }
         $im->done;
-        $config->each_inbox(sub { $_[0]->search->reopen });
+        $cfg->each_inbox(sub { $_[0]->search->reopen });
 }
 
 my $client3 = sub {
diff --git a/t/watch_filter_rubylang.t b/t/watch_filter_rubylang.t
index 6513f30b..9c70b4ea 100644
--- a/t/watch_filter_rubylang.t
+++ b/t/watch_filter_rubylang.t
@@ -72,11 +72,11 @@ $cfgpfx.filter=PublicInbox::Filter::RubyLang
 $cfgpfx.altid=serial:alerts:file=msgmap.sqlite3
 publicinboxwatch.watchspam=maildir:$spamdir
 EOF
-        my $config = PublicInbox::Config->new(\$orig);
-        my $ibx = $config->lookup_name($v);
+        my $cfg = PublicInbox::Config->new(\$orig);
+        my $ibx = $cfg->lookup_name($v);
         ok($ibx, 'found inbox by name');
 
-        my $w = PublicInbox::Watch->new($config);
+        my $w = PublicInbox::Watch->new($cfg);
         for my $i (1..2) {
                 $w->scan('full');
         }
@@ -101,8 +101,8 @@ EOF
         }
         $w->scan('full');
 
-        $config = PublicInbox::Config->new(\$orig);
-        $ibx = $config->lookup_name($v);
+        $cfg = PublicInbox::Config->new(\$orig);
+        $ibx = $cfg->lookup_name($v);
         is($ibx->search->reopen->mset('b:spam')->size, 0, 'spam removed');
 
         is_deeply([], \@warn, 'no warnings');
diff --git a/t/watch_maildir.t b/t/watch_maildir.t
index ae53caf9..c948b41b 100644
--- a/t/watch_maildir.t
+++ b/t/watch_maildir.t
@@ -34,13 +34,13 @@ my $sem = PublicInbox::Emergency->new($spamdir); # create dirs
 {
         my @w;
         local $SIG{__WARN__} = sub { push @w, @_ };
-        my $config = PublicInbox::Config->new(\<<EOF);
+        my $cfg = PublicInbox::Config->new(\<<EOF);
 $cfgpfx.address=$addr
 $cfgpfx.inboxdir=$git_dir
 $cfgpfx.watch=maildir:$spamdir
 publicinboxlearn.watchspam=maildir:$spamdir
 EOF
-        my $wm = PublicInbox::Watch->new($config);
+        my $wm = PublicInbox::Watch->new($cfg);
         is(scalar grep(/is a spam folder/, @w), 1, 'got warning about spam');
         is_deeply($wm->{mdmap}, { "$spamdir/cur" => 'watchspam' },
                 'only got the spam folder to watch');
@@ -61,8 +61,8 @@ EOF
         close $fh or BAIL_OUT $!;
 }
 
-my $config = PublicInbox::Config->new($cfg_path);
-PublicInbox::Watch->new($config)->scan('full');
+my $cfg = PublicInbox::Config->new($cfg_path);
+PublicInbox::Watch->new($cfg)->scan('full');
 my $git = PublicInbox::Git->new($git_dir);
 my @list = $git->qx(qw(rev-list refs/heads/master));
 is(scalar @list, 1, 'one revision in rev-list');
@@ -79,7 +79,7 @@ my $write_spam = sub {
 };
 $write_spam->();
 is(unlink(glob("$maildir/new/*")), 1, 'unlinked old spam');
-PublicInbox::Watch->new($config)->scan('full');
+PublicInbox::Watch->new($cfg)->scan('full');
 @list = $git->qx(qw(rev-list refs/heads/master));
 is(scalar @list, 2, 'two revisions in rev-list');
 @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
@@ -93,7 +93,7 @@ To unsubscribe from this list: send the line "unsubscribe git" in
 the body of a message to majordomo\@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
         PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-        PublicInbox::Watch->new($config)->scan('full');
+        PublicInbox::Watch->new($cfg)->scan('full');
         @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
         is(scalar @list, 1, 'tree has one file');
         my $mref = $git->cat_file('HEAD:'.$list[0]);
@@ -101,7 +101,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
 
         is(unlink(glob("$maildir/new/*")), 1, 'unlinked spam');
         $write_spam->();
-        PublicInbox::Watch->new($config)->scan('full');
+        PublicInbox::Watch->new($cfg)->scan('full');
         @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
         is(scalar @list, 0, 'tree is empty');
         @list = $git->qx(qw(rev-list refs/heads/master));
@@ -115,10 +115,10 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
         my $fail_path = "$fail_bin:$ENV{PATH}"; # for spamc ham mock
         local $ENV{PATH} = $fail_path;
         PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-        $config->{'publicinboxwatch.spamcheck'} = 'spamc';
+        $cfg->{'publicinboxwatch.spamcheck'} = 'spamc';
         {
                 local $SIG{__WARN__} = sub {}; # quiet spam check warning
-                PublicInbox::Watch->new($config)->scan('full');
+                PublicInbox::Watch->new($cfg)->scan('full');
         }
         @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
         is(scalar @list, 0, 'tree has no files spamc checked');
@@ -131,9 +131,9 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
         my $main_path = "$main_bin:$ENV{PATH}"; # for spamc ham mock
         local $ENV{PATH} = $main_path;
         PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-        $config->{'publicinboxwatch.spamcheck'} = 'spamc';
+        $cfg->{'publicinboxwatch.spamcheck'} = 'spamc';
         @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
-        PublicInbox::Watch->new($config)->scan('full');
+        PublicInbox::Watch->new($cfg)->scan('full');
         @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
         is(scalar @list, 1, 'tree has one file after spamc checked');
 
@@ -166,9 +166,9 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
                 $delivered++;
         };
         PublicInbox::DS->Reset;
-        my $ii = PublicInbox::InboxIdle->new($config);
+        my $ii = PublicInbox::InboxIdle->new($cfg);
         my $obj = bless \$cb, 'PublicInbox::TestCommon::InboxWakeup';
-        $config->each_inbox(sub { $_[0]->subscribe_unlock('ident', $obj) });
+        $cfg->each_inbox(sub { $_[0]->subscribe_unlock('ident', $obj) });
         PublicInbox::DS->SetPostLoopCallback(sub { $delivered == 0 });
 
         # wait for -watch to setup inotify watches
diff --git a/t/watch_maildir_v2.t b/t/watch_maildir_v2.t
index 12546418..532e5c7c 100644
--- a/t/watch_maildir_v2.t
+++ b/t/watch_maildir_v2.t
@@ -44,11 +44,11 @@ $cfgpfx.watch=maildir:$maildir
 $cfgpfx.filter=PublicInbox::Filter::Vger
 publicinboxlearn.watchspam=maildir:$spamdir
 EOF
-my $config = PublicInbox::Config->new(\$orig);
-my $ibx = $config->lookup_name('test');
+my $cfg = PublicInbox::Config->new(\$orig);
+my $ibx = $cfg->lookup_name('test');
 ok($ibx, 'found inbox by name');
 
-PublicInbox::Watch->new($config)->scan('full');
+PublicInbox::Watch->new($cfg)->scan('full');
 my $total = scalar @{$ibx->over->recent};
 is($total, 1, 'got one revision');
 
@@ -68,7 +68,7 @@ my $write_spam = sub {
 };
 $write_spam->();
 is(unlink(glob("$maildir/new/*")), 1, 'unlinked old spam');
-PublicInbox::Watch->new($config)->scan('full');
+PublicInbox::Watch->new($cfg)->scan('full');
 is_deeply($ibx->over->recent, [], 'deleted file');
 is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam');
 
@@ -79,7 +79,7 @@ To unsubscribe from this list: send the line "unsubscribe git" in
 the body of a message to majordomo\@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
         PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-        PublicInbox::Watch->new($config)->scan('full');
+        PublicInbox::Watch->new($cfg)->scan('full');
         my $msgs = $ibx->over->recent;
         is(scalar(@$msgs), 1, 'got one file back');
         my $mref = $ibx->msg_by_smsg($msgs->[0]);
@@ -87,7 +87,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
 
         is(unlink(glob("$maildir/new/*")), 1, 'unlinked spam');
         $write_spam->();
-        PublicInbox::Watch->new($config)->scan('full');
+        PublicInbox::Watch->new($cfg)->scan('full');
         $msgs = $ibx->over->recent;
         is(scalar(@$msgs), 0, 'inbox is empty again');
         is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam');
@@ -99,10 +99,10 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
         my $fail_path = "$fail_bin:$ENV{PATH}"; # for spamc ham mock
         local $ENV{PATH} = $fail_path;
         PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-        $config->{'publicinboxwatch.spamcheck'} = 'spamc';
+        $cfg->{'publicinboxwatch.spamcheck'} = 'spamc';
         {
                 local $SIG{__WARN__} = sub {}; # quiet spam check warning
-                PublicInbox::Watch->new($config)->scan('full');
+                PublicInbox::Watch->new($cfg)->scan('full');
         }
         my $msgs = $ibx->over->recent;
         is(scalar(@$msgs), 0, 'inbox is still empty');
@@ -115,13 +115,13 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
         my $main_path = "$main_bin:$ENV{PATH}"; # for spamc ham mock
         local $ENV{PATH} = $main_path;
         PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-        $config->{'publicinboxwatch.spamcheck'} = 'spamc';
-        PublicInbox::Watch->new($config)->scan('full');
+        $cfg->{'publicinboxwatch.spamcheck'} = 'spamc';
+        PublicInbox::Watch->new($cfg)->scan('full');
         my $msgs = $ibx->over->recent;
         is(scalar(@$msgs), 1, 'inbox has one mail after spamc OK-ed a message');
         my $mref = $ibx->msg_by_smsg($msgs->[0]);
         like($$mref, qr/something\n\z/s, 'message scrubbed on import');
-        delete $config->{'publicinboxwatch.spamcheck'};
+        delete $cfg->{'publicinboxwatch.spamcheck'};
 }
 
 {
@@ -129,7 +129,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
         open my $fh, '<', $patch or die "failed to open $patch: $!\n";
         $msg = do { local $/; <$fh> };
         PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-        PublicInbox::Watch->new($config)->scan('full');
+        PublicInbox::Watch->new($cfg)->scan('full');
         my $post = $ibx->search->reopen->mset('dfpost:6e006fd7');
         is($post->size, 1, 'diff postimage found');
         my $pre = $ibx->search->mset('dfpre:090d998b6c2c');
@@ -146,12 +146,12 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
         my $v1pfx = "publicinbox.v1";
         my $v1addr = 'v1-public@example.com';
         PublicInbox::Import::init_bare($v1repo);
-        my $cfg2 = <<EOF;
+        my $raw = <<EOF;
 $orig$v1pfx.address=$v1addr
 $v1pfx.inboxdir=$v1repo
 $v1pfx.watch=maildir:$maildir
 EOF
-        my $config = PublicInbox::Config->new(\$cfg2);
+        my $cfg = PublicInbox::Config->new(\$raw);
         my $both = <<EOF;
 From: user\@example.com
 To: $addr, $v1addr
@@ -162,10 +162,10 @@ Date: Sat, 18 Jun 2016 00:00:00 +0000
 both
 EOF
         PublicInbox::Emergency->new($maildir)->prepare(\$both);
-        PublicInbox::Watch->new($config)->scan('full');
+        PublicInbox::Watch->new($cfg)->scan('full');
         my $mset = $ibx->search->reopen->mset('m:both@b.com');
         my $msgs = $ibx->search->mset_to_smsg($ibx, $mset);
-        my $v1 = $config->lookup_name('v1');
+        my $v1 = $cfg->lookup_name('v1');
         my $msg = $v1->git->cat_file($msgs->[0]->{blob});
         is($both, $$msg, 'got original message back from v1');
         $msg = $ibx->git->cat_file($msgs->[0]->{blob});
@@ -184,21 +184,21 @@ List-Id: <do.not.want>
 X-Mailing-List: no@example.com
 Message-ID: <do.not.want@example.com>
 EOF
-        my $cfg = $orig."$cfgpfx.listid=i.want.you.to.want.me\n";
+        my $raw = $orig."$cfgpfx.listid=i.want.you.to.want.me\n";
         PublicInbox::Emergency->new($maildir)->prepare(\$want);
         PublicInbox::Emergency->new($maildir)->prepare(\$do_not_want);
-        my $config = PublicInbox::Config->new(\$cfg);
-        PublicInbox::Watch->new($config)->scan('full');
-        $ibx = $config->lookup_name('test');
+        my $cfg = PublicInbox::Config->new(\$raw);
+        PublicInbox::Watch->new($cfg)->scan('full');
+        $ibx = $cfg->lookup_name('test');
         my $num = $ibx->mm->num_for('do.want@example.com');
         ok(defined $num, 'List-ID matched for watch');
         $num = $ibx->mm->num_for('do.not.want@example.com');
         is($num, undef, 'unaccepted List-ID matched for watch');
 
-        $cfg = $orig."$cfgpfx.watchheader=X-Mailing-List:no\@example.com\n";
-        $config = PublicInbox::Config->new(\$cfg);
-        PublicInbox::Watch->new($config)->scan('full');
-        $ibx = $config->lookup_name('test');
+        $raw = $orig."$cfgpfx.watchheader=X-Mailing-List:no\@example.com\n";
+        $cfg = PublicInbox::Config->new(\$raw);
+        PublicInbox::Watch->new($cfg)->scan('full');
+        $ibx = $cfg->lookup_name('test');
         $num = $ibx->mm->num_for('do.not.want@example.com');
         ok(defined $num, 'X-Mailing-List matched');
 }
diff --git a/t/watch_multiple_headers.t b/t/watch_multiple_headers.t
index a0813532..1fe392d4 100644
--- a/t/watch_multiple_headers.t
+++ b/t/watch_multiple_headers.t
@@ -54,16 +54,16 @@ PublicInbox::Emergency->new($maildir)->prepare(\$msg_to);
 PublicInbox::Emergency->new($maildir)->prepare(\$msg_cc);
 PublicInbox::Emergency->new($maildir)->prepare(\$msg_none);
 
-my $cfg = <<EOF;
+my $raw = <<EOF;
 $cfgpfx.address=$addr
 $cfgpfx.inboxdir=$inboxdir
 $cfgpfx.watch=maildir:$maildir
 $cfgpfx.watchheader=To:$addr
 $cfgpfx.watchheader=Cc:$addr
 EOF
-my $config = PublicInbox::Config->new(\$cfg);
-PublicInbox::Watch->new($config)->scan('full');
-my $ibx = $config->lookup_name('test');
+my $cfg = PublicInbox::Config->new(\$raw);
+PublicInbox::Watch->new($cfg)->scan('full');
+my $ibx = $cfg->lookup_name('test');
 ok($ibx, 'found inbox by name');
 
 my $num = $ibx->mm->num_for('to@a.com');