File: 25-common-opts.t

package info (click to toggle)
libsystem-sub-perl 0.162800-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 196 kB
  • sloc: perl: 253; sh: 6; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 724 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 strict;
use warnings;

use Test::More tests => 5;
use File::Spec;

# Test common options and prototypes
use System::Sub [ 0 => $^X, ARGV => [ File::Spec->catfile(qw(t print.pl)) ] ],
                qw< print1($) print2($$) >,
                printenv => [
                    ENV  => { Toto => 'Lulu' },
                    '--' => File::Spec->catfile(qw(t printenv.pl)), 'Toto'
                ];

is(  scalar print1('x'),   'x', 'print1 (scalar)');
is_deeply([ print1('y') ], [ 'y' ], 'print1 (list)');

is(  scalar print2('x', 'y'),   'x',           'print2 (scalar)');
is_deeply([ print2('x', 'y') ], [ qw< x y > ], 'print2 (list)');

is_deeply([ printenv ], [ 'Lulu' ], 'printenv Toto');

# vim:set et sw=4 sts=4: