File: 32pieces-anonsub.t

package info (click to toggle)
libxs-parse-keyword-perl 0.49-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 572 kB
  • sloc: ansic: 2,037; perl: 1,013; sh: 6; makefile: 3
file content (28 lines) | stat: -rw-r--r-- 606 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl

use v5.14;
use warnings;

use Test2::V0;

use lib "t";
use testcase "t::pieces";

BEGIN { $^H{"t::pieces/permit"} = 1; }

{
   my $ret = pieceanonsub { "sub value" };
   is( ref $ret, "CODE", 'result of pieceanonsub is CODE reference' );
   is( $ret->(), "sub value", 'result of invoking' );
}

{
   my $ret = piecestagedanonsub { return "$VAR, world" };

   is( ref $ret, "CODE", 'result of piecestagedanonsub is CODE reference' );
   is( $ret->(), "Hello, world", 'result of invoking' );

   is( $::STAGES, "PREPARE,START,END,WRAP", 'All ANONSUB stages were invoked' );
}

done_testing;