File: 09-defined-or.t

package info (click to toggle)
libfilter-signatures-perl 0.19-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 236 kB
  • sloc: perl: 1,321; makefile: 2
file content (50 lines) | stat: -rw-r--r-- 980 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
40
41
42
43
44
45
46
47
48
49
50
#!perl -w
use strict;
use Test::More tests => 2;
use Data::Dumper;

use  Text::Balanced 'extract_multiple', 'extract_quotelike';

require Filter::signatures;

# Mimic parts of the setup of Filter::Simple
my $extractor =
$Filter::Simple::placeholder = $Filter::Simple::placeholder
    = qr/\Q$;\E(.{4})\Q$;\E/s;

# Defined-or
$_ = <<'SUB';
sub (
$name
    , $value //= 'bar'
    ) {
        return "'$name' is '$value'"
    };
SUB
Filter::signatures::transform_arguments();
is $_, <<'RESULT', "Multiline signatures get converted for anonymous subs";
sub  { my ($name,$value)=@_;$value //= 'bar';();



        return "'$name' is '$value'"
    };
RESULT

$_ = <<'SUB';
sub (
$name
    , $value ||= 'bar'
    ) {
        return "'$name' is '$value'"
    };
SUB
Filter::signatures::transform_arguments();
is $_, <<'RESULT', "Multiline signatures get converted for anonymous subs";
sub  { my ($name,$value)=@_;$value ||= 'bar';();



        return "'$name' is '$value'"
    };
RESULT