File: 10argument-types.t

package info (click to toggle)
libpackage-variant-perl 1.003002-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 148 kB
  • sloc: perl: 116; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 538 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
use strictures 2;
use Test::More;

BEGIN {
  package TestVariable;
  use Package::Variant;
  sub make_variant {
    my ($class, $target, @args) = @_;
    install variant_values => sub { [@args] };
  }
  $INC{'TestVariable.pm'} = __FILE__;
}

use TestVariable;

is_deeply TestVariable(23)->variant_values, [23],
  'simple value argument';
is_deeply TestVariable(3..7)->variant_values, [3..7],
  'multiple value arguments';
is_deeply TestVariable({ foo => 23 })->variant_values, [{ foo => 23 }],
  'hash reference argument';

done_testing;