diff options
author | Eric Wong <normalperson@yhbt.net> | 2014-03-27 19:38:06 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2014-03-28 02:35:21 +0000 |
commit | 67e53d0875a7efcb958fb9680ea87216adaf06cc (patch) | |
tree | 9d0d39852dbd24347976e337dd1af044bafe0cc6 /t | |
parent | cf0a2370a57fe49d0fca149409f98d2907efeb15 (diff) | |
download | public-inbox-67e53d0875a7efcb958fb9680ea87216adaf06cc.tar.gz |
Diffstat (limited to 't')
-rw-r--r-- | t/config.t | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -8,16 +8,32 @@ use File::Temp qw/tempdir/; my $tmpdir = tempdir(CLEANUP => 1); { - is(system(qw(git init --bare), $tmpdir), 0, "git init successful"); + is(system(qw(git init -q --bare), $tmpdir), 0, "git init successful"); { local $ENV{GIT_DIR} = $tmpdir; is(system(qw(git config foo.bar hihi)), 0, "set config"); } - my $tmp = PublicInbox::Config->dump("$tmpdir/config"); + my $tmp = PublicInbox::Config->new("$tmpdir/config"); is("hihi", $tmp->{"foo.bar"}, "config read correctly"); is("true", $tmp->{"core.bare"}, "used --bare repo"); } +{ + my $f = "examples/public-inbox-config"; + ok(-r $f, "$f is readable"); + + my $cfg = PublicInbox::Config->new($f); + is_deeply($cfg->lookup('bugs@public-inbox.org'), { + 'failrepo' => '/home/pi/bugs-fail.git', + 'mainrepo' => '/home/pi/bugs-main.git', + 'address' => 'bugs@public-inbox.org', + 'description' => 'development discussion' + }, "lookup matches expected output"); + + is($cfg->lookup('blah@example.com'), undef, + "non-existent lookup returns undef"); +} + done_testing(); |