about summary refs log tree commit homepage
path: root/t/lei-oneshot.t
diff options
context:
space:
mode:
Diffstat (limited to 't/lei-oneshot.t')
-rw-r--r--t/lei-oneshot.t25
1 files changed, 25 insertions, 0 deletions
diff --git a/t/lei-oneshot.t b/t/lei-oneshot.t
new file mode 100644
index 00000000..3b8e412d
--- /dev/null
+++ b/t/lei-oneshot.t
@@ -0,0 +1,25 @@
+#!perl -w
+# Copyright (C) 2020 all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+use strict;
+use v5.10.1;
+use PublicInbox::TestCommon;
+$PublicInbox::TestCommon::cached_scripts{'lei-oneshot'} //= do {
+        eval <<'EOF';
+package LeiOneshot;
+use strict;
+use subs qw(exit);
+*exit = \&PublicInbox::TestCommon::run_script_exit;
+sub main {
+# the below "line" directive is a magic comment, see perlsyn(1) manpage
+# line 1 "lei-oneshot"
+        require PublicInbox::LEI;
+        PublicInbox::LEI::oneshot(__PACKAGE__);
+        0;
+}
+1;
+EOF
+        LeiOneshot->can('main');
+};
+local $ENV{TEST_LEI_ONESHOT} = '1';
+require './t/lei.t';