From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id C65822007E for ; Thu, 31 Dec 2020 13:51:57 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 30/36] t/ipc.t: test for references via `die' Date: Thu, 31 Dec 2020 13:51:48 +0000 Message-Id: <20201231135154.6070-31-e@80x24.org> In-Reply-To: <20201231135154.6070-1-e@80x24.org> References: <20201231135154.6070-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We'll probably start using references as exceptions in some places for more exact matching. --- t/ipc.t | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/t/ipc.t b/t/ipc.t index f3715e2c..5ee45e63 100644 --- a/t/ipc.t +++ b/t/ipc.t @@ -45,6 +45,19 @@ my $test = sub { is((values %lines)[0], 2, '2 hits on same line number'); is($err, $exp, "$x die matches"); is($ret, undef, "$x die did not return"); + + eval { $ipc->test_die(['arrayref']) }; + $exp = $@; + $ret = eval { $ipc->ipc_do('test_die', ['arrayref']) }; + $err = $@; + is_deeply($err, $exp, 'die with unblessed ref'); + is(ref($err), 'ARRAY', 'got an array ref'); + + $exp = bless ['blessed'], 'PublicInbox::WTF'; + $ret = eval { $ipc->ipc_do('test_die', $exp) }; + $err = $@; + is_deeply($err, $exp, 'die with blessed ref'); + is(ref($err), 'PublicInbox::WTF', 'got blessed ref'); }; $test->('local');