[go: up one dir, main page]

File: case.t

package info (click to toggle)
libgetargs-long-perl 0.1.3-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 120 kB
  • ctags: 15
  • sloc: perl: 617; makefile: 44
file content (72 lines) | stat: -rw-r--r-- 1,222 bytes parent folder | download | duplicates (2)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!./perl

#
# $Id: case.t,v 0.1.1.1 2001/03/20 10:34:48 ram Exp $
#
#  Copyright (c) 2000-2001, Raphael Manfredi
#  
#  You may redistribute only under the terms of the Artistic License,
#  as specified in the README file that comes with the distribution.
#
# HISTORY
# $Log: case.t,v $
# Revision 0.1.1.1  2001/03/20 10:34:48  ram
# patch3: updated all getargs() calls to new interface
#
# Revision 0.1  2001/03/01 18:37:19  ram
# Baseline for first alpha release.
#
# $EndLog$
#

print "1..9\n";

require 't/code.pl';
sub ok;

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);
ok 1, @a == 2;
ok 2, $a[0] == 1;
ok 3, $a[1] == 2;

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

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