about summary refs log tree commit homepage
path: root/t/init.t
diff options
context:
space:
mode:
Diffstat (limited to 't/init.t')
-rw-r--r--t/init.t22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/init.t b/t/init.t
new file mode 100644
index 00000000..766e81b1
--- /dev/null
+++ b/t/init.t
@@ -0,0 +1,22 @@
+# Copyright (C) 2014, 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);
+use constant pi_init => 'blib/script/public-inbox-init';
+
+{
+        local $ENV{PI_DIR} = "$tmpdir/.public-inbox/";
+        my $cfgfile = "$ENV{PI_DIR}/config";
+        my @cmd = (pi_init, 'blist', "$tmpdir/blist",
+                   qw(http://example.com/blist blist@example.com));
+        is(system(@cmd), 0, join(' ', @cmd). ' failed');
+
+        ok(-e $cfgfile, "config exists, now");
+        is(system(@cmd), 0, join(' ', @cmd). ' failed (idempotent)');
+}
+
+done_testing();