]> Sergey Matveev's repositories - public-inbox.git/commitdiff
t/ipc.t: test for references via `die'
authorEric Wong <e@80x24.org>
Thu, 31 Dec 2020 13:51:48 +0000 (13:51 +0000)
committerEric Wong <e@80x24.org>
Fri, 1 Jan 2021 05:00:40 +0000 (05:00 +0000)
We'll probably start using references as exceptions in
some places for more exact matching.

t/ipc.t

diff --git a/t/ipc.t b/t/ipc.t
index f3715e2c879c84a2bca8753c5ae543715c7a7dc8..5ee45e63b5a7444411e0088ea547ca804c492dab 100644 (file)
--- 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');