File: 34pieces-ident.t

package info (click to toggle)
libxs-parse-keyword-perl 0.48-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 572 kB
  • sloc: ansic: 2,037; perl: 1,013; sh: 6; makefile: 3
file content (39 lines) | stat: -rw-r--r-- 854 bytes parent folder | download
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
29
30
31
32
33
34
35
36
37
38
39
#!/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 = pieceident foobar;
   is( $ret, "foobar", 'result of pieceident' );

   ok( !defined eval 'pieceident',
      'pieceident complains of missing ident' );
   like( $@, qr/^Expected an identifier at /, 'message from missing ident' );
}

{
   my $ret = pieceident_opt present;
   is( $ret, "present", 'result of pieceident_opt with ident' );

   $ret = pieceident_opt;
   ok( !defined $ret, 'result of pieceident_opt without' );
}

{
   my $ret = piecepkg Bar::Foo;
   is( $ret, "Bar::Foo", 'result of piecepkg' );

   ok( !defined eval 'piecepkg',
      'piecepkg complains of missing packagename' );
   like( $@, qr/^Expected a package name at /, 'message from missing packagename' );
}

done_testing;