- my $addr = "i$V\@example.com";
- my $name = "i$V";
- my $url = "http://example.com/i$V";
- my $inboxdir = "$tmpdir/$name";
- my $folder = "inbox.i$V";
- my $cmd = ['-init', "-V$V", "-L$level", "--ng=$folder",
- $name, $inboxdir, $url, $addr];
- run_script($cmd) or BAIL_OUT("init $name");
- if ($V == 1) {
- xsys(qw(git config), "--file=$ENV{HOME}/.public-inbox/config",
- 'publicinboxmda.spamcheck', 'none') == 0 or
- BAIL_OUT("config: $?");
- }
- open(my $fh, '<', 't/utf8.eml') or BAIL_OUT("open t/utf8.eml: $!");
- my $env = { ORIGINAL_RECIPIENT => $addr };
- run_script(['-mda', '--no-precheck'], $env, { 0 => $fh }) or
- BAIL_OUT('-mda delivery');
- if ($V == 1) {
- run_script(['-index', $inboxdir]) or BAIL_OUT("index $?");
- }
+ my $ibx = create_inbox("i$V-$level",
+ tmpdir => "$tmpdir/i$V", version => $V,
+ indexlevel => $level, sub {
+ my ($im) = @_;
+ $im->add($eml //= eml_load('t/utf8.eml')) or BAIL_OUT;
+ });
+ push @ibx, $ibx;
+ $ibx->{newsgroup} = "inbox.i$V";
+ print $cfgfh <<EOF or BAIL_OUT;
+[publicinbox "i$V"]
+ inboxdir = $ibx->{inboxdir}
+ address = $ibx->{-primary_address};
+ newsgroup = inbox.i$V
+ url = http://example.com/i$V
+ indexlevel = $level
+EOF