]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
test_common: key2sub: detect syntax errors early
authorEric Wong <e@80x24.org>
Sat, 15 Feb 2025 11:10:07 +0000 (11:10 +0000)
committerEric Wong <e@80x24.org>
Mon, 17 Feb 2025 20:09:08 +0000 (20:09 +0000)
Instead of attempting to use an `undef' $sub as a coderef;
detect compile errors early and die immediately if `eval'
raises an exception.

lib/PublicInbox/TestCommon.pm

index cbcfc008c9e6af3c2c0a251a869f4d7ad8fb30c8..e11781491794378b8251ec9439a61be85a32847b 100644 (file)
@@ -371,6 +371,7 @@ sub main {
 }
 1;
 EOF
+               die "E: $f failed: $@" if $@;
                $pkg->can('main');
        }
 }