File: signatures.t

package info (click to toggle)
libppi-perl 1.283-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,216 kB
  • sloc: perl: 15,295; makefile: 8
file content (57 lines) | stat: -rwxr-xr-x 739 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/perl

# PPI doesn't know about signatures, but we just want to ensure that it doesn't
# lose newlines when it tracks the content of the token.

use strict;
use warnings;

use PPI::Document ();
use Test::More;

use lib 't/lib';
use Helper 'safe_new';

my $sigs = <<'EOF';
use strict;
use warnings;

use feature qw(signatures);
no warnings qw(experimental::signatures);

sub foo (
    $self, $bar,
    $thing_id = 12
) {
    1;
}

sub bar ($self,$bar,%) {
    2;
}

sub baz (


    $, $bar,

    $thing_id = 12,

    @


) {
    1;
}

sub other ( $= ) { }

sub default ( $default = foo() ) { }

EOF

my $doc = safe_new \$sigs;
$doc->serialize;
is( $doc->content, $sigs, 'whitespace in signatures is preserved' );

done_testing();