File: case.t

package info (click to toggle)
libgetargs-long-perl 1.1012-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 280 kB
  • sloc: perl: 2,303; makefile: 2
file content (52 lines) | stat: -rwxr-xr-x 708 bytes parent folder | download | duplicates (10)
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
51
52
#!./perl

use Test::More tests => 9;

require 't/code.pl';

package SENSITIVE;

use Getargs::Long;

sub f {
	my ($x, $X) = getargs(@_, { -strict => 0 }, qw(x X));
	return ($x, $X);
}

package INSENSITIVE;

use Getargs::Long qw(ignorecase);

sub f {
	my ($x, $Y) = getargs(@_, { -strict => 0 }, qw(x Y));
	return ($x, $Y);
}

package OPTION;

use Getargs::Long;

sub f {
	my ($x, $Y) = getargs(@_, { -strict => 0, -ignorecase => 1 }, qw(x Y));
	return ($x, $Y);
}

package main;

my @a;

@a = SENSITIVE::f(-x => 1, -X => 2);
is(@a,2);
is($a[0],1);
is($a[1],2);

@a = INSENSITIVE::f(-x => 1, -y => 2);
is(@a,2);
is($a[0],1);
is($a[1],2);

@a = OPTION::f(-x => 1, -y => 2);
is(@a,2);
is($a[0],1);
is($a[1],2);