From cfa8ff7c256e20f3240aed5f98d155c019788e3b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 20 Jan 2019 20:56:22 +0000 Subject: config: each_inbox iteration preserves config order For cross-inbox Message-ID resolution; having some sort of stable ordering makes the most sense. Relying on the order of the config file seems most natural and allows us to avoid introducing yet another configuration knob. --- t/config.t | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 't') diff --git a/t/config.t b/t/config.t index 5f0a95ba..7531fd75 100644 --- a/t/config.t +++ b/t/config.t @@ -150,4 +150,23 @@ for my $s (@valid) { ok(PublicInbox::Config::valid_inbox_name($s), "$d name accepted"); } +{ + my $f = "$tmpdir/ordered"; + open my $fh, '>', $f or die "open: $!"; + my @expect; + foreach my $i (0..3) { + push @expect, "$i"; + print $fh <<"" or die "print: $!"; +[publicinbox "$i"] + mainrepo = /path/to/$i.git + address = $i\@example.com + + } + close $fh or die "close: $!"; + my $cfg = PublicInbox::Config->new($f); + my @result; + $cfg->each_inbox(sub { push @result, $_[0]->{name} }); + is_deeply(\@result, \@expect); +} + done_testing(); -- cgit v1.2.3-24-ge0c7