File: newgetopt.t

package info (click to toggle)
libperl4-corelibs-perl 0.004-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 368 kB
  • sloc: perl: 2,549; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 556 bytes parent folder | download | duplicates (6)
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
use warnings;
use strict;

use Test::More tests => 11;

require_ok "newgetopt.pl";

our($opt_foo, $opt_Foo, $opt_bar, $opt_baR);

@ARGV = qw(-Foo -baR --foo bar);
$newgetopt::ignorecase = 0;
$newgetopt::ignorecase = 0;
undef $opt_baR;
undef $opt_bar;
ok NGetOpt("foo", "Foo=s");
is $opt_foo, 1;
is $opt_Foo, "-baR";
is_deeply \@ARGV, [ "bar" ];
ok !defined($opt_baR);
ok !defined($opt_bar);

@ARGV = qw(--foo -- --bar j);
undef $opt_foo;
undef $opt_bar;
ok NGetOpt("foo", "bar");
is_deeply \@ARGV, [qw(--bar j)];
is $opt_foo, 1;
ok !defined($opt_bar);

1;