File: b-concise.t

package info (click to toggle)
libref-util-perl 0.204-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 252 kB
  • sloc: perl: 610; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 579 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use strict;
use warnings;
use Test::More;
use Ref::Util 'is_arrayref';
require B::Concise;

plan skip_all => 'This version of B::Concise does not have "compile"'
    if !B::Concise->can('compile');

plan skip_all => 'nothing to do when no custom ops'
    if !Ref::Util::_using_custom_ops();

plan tests => 2;

sub func { is_arrayref([]) }

my $walker = B::Concise::compile('-exec', 'func', \&func);
B::Concise::walk_output(\ my $buf);
eval { $walker->() };
my $exn = $@;

ok(!$exn, 'deparsing ops succeeded');
like($buf, qr/\b is_arrayref \b/x, 'deparsing found the custom op');