File: defaults_regress.t

package info (click to toggle)
libfunction-parameters-perl 2.002005-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 624 kB
  • sloc: perl: 3,945; makefile: 3
file content (25 lines) | stat: -rw-r--r-- 372 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
24
25
#!perl

use Test::More tests => 3;

use warnings FATAL => 'all';
use strict;

use Function::Parameters {
    fun => {
        default_arguments => 1,
    },
};

{
    my ($d0, $d1, $d2, $d3);
    my $default = 'aaa';

    fun padness($x = $default++) {
        return $x;
    }

    is padness('unrelated'), 'unrelated';
    is &padness(), 'aaa';
    is padness, 'aab';
}