* [PATCH] config: do not nest multi-value altid arrays
@ 2016-08-12 2:22 7% Eric Wong
0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2016-08-12 2:22 UTC (permalink / raw)
To: meta
Oops. We will inevitably need to support multiple altids for a
public-inbox one day.
---
lib/PublicInbox/Config.pm | 2 +-
t/config.t | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index cd88548..5eae1f1 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -147,7 +147,7 @@ sub _fill {
}
foreach my $k (qw(altid)) { # TODO: more arrays
if (defined(my $v = $self->{"$pfx.$k"})) {
- $rv->{$k} = [ $v ];
+ $rv->{$k} = ref($v) eq 'ARRAY' ? $v : [ $v ];
}
}
diff --git a/t/config.t b/t/config.t
index 77e8f4a..073d1d0 100644
--- a/t/config.t
+++ b/t/config.t
@@ -50,4 +50,17 @@ my $tmpdir = tempdir('pi-config-XXXXXX', TMPDIR => 1, CLEANUP => 1);
}, "lookup matches expected output for test");
}
+
+{
+ my $cfgpfx = "publicinbox.test";
+ my @altid = qw(serial:gmane:file=a serial:enamg:file=b);
+ my $config = PublicInbox::Config->new({
+ "$cfgpfx.address" => 'test@example.com',
+ "$cfgpfx.mainrepo" => '/path/to/non/existent',
+ "$cfgpfx.altid" => [ @altid ],
+ });
+ my $ibx = $config->lookup_name('test');
+ is_deeply($ibx->{altid}, [ @altid ]);
+}
+
done_testing();
--
EW
^ permalink raw reply related [relevance 7%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-08-12 2:22 7% [PATCH] config: do not nest multi-value altid arrays Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).