File: 11_extraction.t

package info (click to toggle)
libmodule-install-perl 1.21-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 636 kB
  • sloc: perl: 3,569; makefile: 13
file content (182 lines) | stat: -rw-r--r-- 3,949 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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
use strict;
BEGIN {
        $|  = 1;
        $^W = 1;
}

use Test::More tests => 16;

require_ok( 'Module::Install::Metadata' );

SCOPE: {
	my @links=Module::Install::Metadata::_extract_bugtracker('L<http://rt.cpan.org/test>');
	is_deeply(
		\@links,
		[ 'http://rt.cpan.org/test' ],
		'1 bugtracker extracted',
	) or diag(
		"bugtrackers: @links"
	);
}

SCOPE: {
	my @links=Module::Install::Metadata::_extract_bugtracker('L<http://rt.cpan.org/test1> L<http://rt.cpan.org/test1>');
	is_deeply(
		\@links,
		[ 'http://rt.cpan.org/test1' ],
		'1 bugtracker extracted (2 links)',
	) or diag(
		"bugtrackers: @links"
	);
}

SCOPE: {
	my @links=Module::Install::Metadata::_extract_bugtracker('L<http://rt.cpan.org/test1> L<http://rt.cpan.org/test2>');
	is_deeply(
		[ sort @links ],
		[ 'http://rt.cpan.org/test1', 'http://rt.cpan.org/test2' ],
		'2 bugtrackers extracted',
	) or diag(
		"bugtrackers: @links"
	);
}

SCOPE: {
	my @links=Module::Install::Metadata::_extract_bugtracker('L<http://search.cpan.org/test1>');
	is_deeply(
		\@links,
		[ ],
		'0 bugtrackers extracted',
	) or diag(
		"bugtrackers: @links"
	);
}

SCOPE: {
	my @links=Module::Install::Metadata::_extract_bugtracker('L<http://github.com/marcusramberg/mojomojo/issues>');
	is_deeply(
		\@links,
		[ 'http://github.com/marcusramberg/mojomojo/issues' ],
		'1 bugtracker (github.com) extracted',
	) or diag(
		"bugtrackers: @links"
	);
}

SCOPE: {
	my @links=Module::Install::Metadata::_extract_bugtracker('L<http://code.google.com/p/www-mechanize/issues/list>');
	is_deeply(
		\@links,
		[ 'http://code.google.com/p/www-mechanize/issues/list' ],
		'1 bugtracker (code.google.com) extracted',
	) or diag(
		"bugtrackers: @links"
	);
}




SCOPE: {
	my $l=Module::Install::Metadata::_extract_license("=head1 Copyright\nunder the same terms as the perl programming language\n=cut\n");
		is($l, 'perl', 'Perl license detected',
	);
}

SCOPE: {
        my $text="=head1 LICENSE

This is free software, you may use it and distribute it under
the same terms as Perl itself.

=head1 SEE ALSO

test

=cut
";
	my $l=Module::Install::Metadata::_extract_license($text);
		is($l, 'perl', 'Perl license detected',
	);
}

SCOPE: {
        my $text="=head1 COPYRIGHTS

This module is distributed under the same terms as Perl itself.

=cut
";
	my $l=Module::Install::Metadata::_extract_license($text);
		is($l, 'perl', 'Perl license detected',
	);
}

SCOPE: {
	my $l=Module::Install::Metadata::_extract_license("=head1 COPYRIGHT\nAs LGPL license\n=cut\n");
		is($l, 'lgpl', 'LGPL detected',
	);
}

SCOPE: {
        my $text=<<'EOT';
=head1 COPYRIGHT AND LICENCE

... is free software; you can redistribute it and/or modify it under
the terms of Perl itself, that is to say, under the terms of either:

=over 4

=item *

The GNU General Public License as published by the Free Software Foundation;
either version 2, or (at your option) any later version, or

=item *

The "Artistic License" which comes with Perl.

=back

=cut
EOT
	my $l=Module::Install::Metadata::_extract_license($text);
		is($l, 'perl', 'Perl license detected',
	);
}


SCOPE: {
        my $text=<<'EOT';
=head1 COPYRIGHT AND LICENCE

Copyright (C) 2010

This library is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://opensource.org/licenses/artistic-license-2.0.php.

=cut
EOT
	my $l=Module::Install::Metadata::_extract_license($text);
		is($l, 'artistic_2', 'Artistic 2.0 license detected',
	);
}



SCOPE: {
	my $version=Module::Install::Metadata::_extract_perl_version("use 5.10.0;");
		is($version, '5.10.0', 'perl 5.10.0 detected',
	);
}

SCOPE: {
	my $version=Module::Install::Metadata::_extract_perl_version("   use 5.010;");
		is($version, '5.010', 'perl 5.10.0 detected',
	);
}

SCOPE: {
	my $version=Module::Install::Metadata::_extract_perl_version("use strict;");
		is($version, undef, 'no perl prereq',
	);
}