From 419f8eb672754cd99d6ec12a1f7af0d85ae70795 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 6 Feb 2014 22:19:20 +0000 Subject: trivial config module for dumping config We'll be using git config files after all... --- t/config.t | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 t/config.t (limited to 't') diff --git a/t/config.t b/t/config.t new file mode 100644 index 00000000..7dddd2e8 --- /dev/null +++ b/t/config.t @@ -0,0 +1,23 @@ +# Copyright (C) 2014, Eric Wong and all contributors +# License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt) +use strict; +use warnings; +use Test::More; +use PublicInbox::Config; +use File::Temp qw/tempdir/; +my $tmpdir = tempdir(CLEANUP => 1); + +{ + is(system(qw(git init --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"); + + is("hihi", $tmp->{"foo.bar"}, "config read correctly"); + is("true", $tmp->{"core.bare"}, "used --bare repo"); +} + +done_testing(); -- cgit v1.2.3-24-ge0c7