Some escapes were mentioned twice, although they're not qr//-specific
[p5sagit/p5-mst-13.2.git] / lib / version.t
CommitLineData
129318bd 1#! /usr/local/perl -w
a7ad731c 2# Before `make install' is performed this script should be runnable with
3# `make test'. After `make install' it should work as `perl test.pl'
a7ad731c 4
5#########################
6
34ba6322 7use Test::More qw(no_plan);
c8a14fb6 8require Test::Harness;
9no warnings 'once';
10*Verbose = \$Test::Harness::Verbose;
a7ad731c 11
137d6fc0 12diag "Tests with base class" unless $ENV{PERL_CORE};
a7ad731c 13
5eb567df 14BEGIN {
43eaf59d 15 use_ok("version", 0.50); # If we made it this far, we are ok.
5eb567df 16}
17
137d6fc0 18BaseTests("version");
19
20diag "Tests with empty derived class" unless $ENV{PERL_CORE};
21
22package version::Empty;
43eaf59d 23use base version;
137d6fc0 24$VERSION = 0.01;
43eaf59d 25no warnings 'redefine';
26*::qv = sub { return bless version::qv(shift), __PACKAGE__; };
137d6fc0 27
e0218a61 28package version::Bad;
29use base version;
30sub new { my($self,$n)=@_; bless \$n, $self }
31
137d6fc0 32package main;
e0218a61 33my $testobj = version::Empty->new(1.002_003);
137d6fc0 34isa_ok( $testobj, "version::Empty" );
35ok( $testobj->numify == 1.002003, "Numified correctly" );
9137345a 36ok( $testobj->stringify eq "1.002003", "Stringified correctly" );
37ok( $testobj->normal eq "v1.2.3", "Normalified correctly" );
137d6fc0 38
e0218a61 39my $verobj = version->new("1.2.4");
137d6fc0 40ok( $verobj > $testobj, "Comparison vs parent class" );
41ok( $verobj gt $testobj, "Comparison vs parent class" );
42BaseTests("version::Empty");
43
e0218a61 44diag "tests with bad subclass" unless $ENV{PERL_CORE};
45$testobj = version::Bad->new(1.002_003);
46isa_ok( $testobj, "version::Bad" );
47eval { my $string = $testobj->numify };
48like($@, qr/Invalid version object/,
49 "Bad subclass numify");
50eval { my $string = $testobj->normal };
51like($@, qr/Invalid version object/,
52 "Bad subclass normal");
53eval { my $string = $testobj->stringify };
54like($@, qr/Invalid version object/,
55 "Bad subclass stringify");
56eval { my $test = $testobj > 1.0 };
57like($@, qr/Invalid version object/,
58 "Bad subclass vcmp");
59
c0b17f21 60# dummy up a redundant call to satify David Wheeler
61local $SIG{__WARN__} = sub { die $_[0] };
62eval 'use version;';
63unlike ($@, qr/^Subroutine main::qv redefined/,
64 "Only export qv once per package (to prevent redefined warnings).");
65
137d6fc0 66sub BaseTests {
67
317f7c8a 68 my ($CLASS, $no_qv) = @_;
69
70 # Insert your test code below, the Test module is use()ed here so read
71 # its man page ( perldoc Test ) for help writing this test script.
72
73 # Test bare number processing
74 diag "tests with bare numbers" if $Verbose;
75 $version = $CLASS->new(5.005_03);
8cb289bd 76 is ( "$version" , "5.00503" , '5.005_03 eq 5.00503' );
317f7c8a 77 $version = $CLASS->new(1.23);
8cb289bd 78 is ( "$version" , "1.23" , '1.23 eq "1.23"' );
317f7c8a 79
80 # Test quoted number processing
81 diag "tests with quoted numbers" if $Verbose;
82 $version = $CLASS->new("5.005_03");
8cb289bd 83 is ( "$version" , "5.005_03" , '"5.005_03" eq "5.005_03"' );
317f7c8a 84 $version = $CLASS->new("v1.23");
8cb289bd 85 is ( "$version" , "v1.23" , '"v1.23" eq "v1.23"' );
317f7c8a 86
87 # Test stringify operator
88 diag "tests with stringify" if $Verbose;
89 $version = $CLASS->new("5.005");
90 is ( "$version" , "5.005" , '5.005 eq "5.005"' );
91 $version = $CLASS->new("5.006.001");
8cb289bd 92 is ( "$version" , "5.006.001" , '5.006.001 eq v5.6.1' );
317f7c8a 93 $version = $CLASS->new("1.2.3_4");
8cb289bd 94 is ( "$version" , "1.2.3_4" , 'alpha version 1.2.3_4 eq v1.2.3_4' );
317f7c8a 95
96 # test illegal formats
97 diag "test illegal formats" if $Verbose;
98 eval {my $version = $CLASS->new("1.2_3_4")};
99 like($@, qr/multiple underscores/,
100 "Invalid version format (multiple underscores)");
101
102 eval {my $version = $CLASS->new("1.2_3.4")};
103 like($@, qr/underscores before decimal/,
104 "Invalid version format (underscores before decimal)");
105
106 eval {my $version = $CLASS->new("1_2")};
107 like($@, qr/alpha without decimal/,
108 "Invalid version format (alpha without decimal)");
109
110 # for this first test, just upgrade the warn() to die()
111 eval {
112 local $SIG{__WARN__} = sub { die $_[0] };
113 $version = $CLASS->new("1.2b3");
114 };
115 my $warnregex = "Version string '.+' contains invalid data; ".
116 "ignoring: '.+'";
117
118 like($@, qr/$warnregex/,
119 "Version string contains invalid data; ignoring");
120
121 # from here on out capture the warning and test independently
f34c6aaf 122 {
317f7c8a 123 my $warning;
124 local $SIG{__WARN__} = sub { $warning = $_[0] };
125 $version = $CLASS->new("99 and 44/100 pure");
126
127 like($warning, qr/$warnregex/,
128 "Version string contains invalid data; ignoring");
8cb289bd 129 is ("$version", "99", '$version eq "99"');
317f7c8a 130 ok ($version->numify == 99.0, '$version->numify == 99.0');
131 ok ($version->normal eq "v99.0.0", '$version->normal eq v99.0.0');
132
133 $version = $CLASS->new("something");
134 like($warning, qr/$warnregex/,
135 "Version string contains invalid data; ignoring");
136 ok (defined $version, 'defined $version');
137
138 # reset the test object to something reasonable
139 $version = $CLASS->new("1.2.3");
140
141 # Test boolean operator
142 ok ($version, 'boolean');
143
144 # Test class membership
145 isa_ok ( $version, $CLASS );
146
147 # Test comparison operators with self
148 diag "tests with self" if $Verbose;
8cb289bd 149 is ( $version <=> $version, 0, '$version <=> $version == 0' );
317f7c8a 150 ok ( $version == $version, '$version == $version' );
151
317f7c8a 152 # Test Numeric Comparison operators
153 # test first with non-object
8cb289bd 154 $version = $CLASS->new("5.006.001");
317f7c8a 155 $new_version = "5.8.0";
156 diag "numeric tests with non-objects" if $Verbose;
157 ok ( $version == $version, '$version == $version' );
158 ok ( $version < $new_version, '$version < $new_version' );
159 ok ( $new_version > $version, '$new_version > $version' );
160 ok ( $version != $new_version, '$version != $new_version' );
161
162 # now test with existing object
163 $new_version = $CLASS->new($new_version);
164 diag "numeric tests with objects" if $Verbose;
165 ok ( $version < $new_version, '$version < $new_version' );
166 ok ( $new_version > $version, '$new_version > $version' );
167 ok ( $version != $new_version, '$version != $new_version' );
168
169 # now test with actual numbers
170 diag "numeric tests with numbers" if $Verbose;
171 ok ( $version->numify() == 5.006001, '$version->numify() == 5.006001' );
172 ok ( $version->numify() <= 5.006001, '$version->numify() <= 5.006001' );
173 ok ( $version->numify() < 5.008, '$version->numify() < 5.008' );
174 #ok ( $version->numify() > v5.005_02, '$version->numify() > 5.005_02' );
175
176 # test with long decimals
177 diag "Tests with extended decimal versions" if $Verbose;
178 $version = $CLASS->new(1.002003);
8cb289bd 179 ok ( $version == "1.2.3", '$version == "1.2.3"');
317f7c8a 180 ok ( $version->numify == 1.002003, '$version->numify == 1.002003');
181 $version = $CLASS->new("2002.09.30.1");
8cb289bd 182 ok ( $version == "2002.9.30.1",'$version == 2002.9.30.1');
317f7c8a 183 ok ( $version->numify == 2002.009030001,
184 '$version->numify == 2002.009030001');
185
186 # now test with alpha version form with string
187 $version = $CLASS->new("1.2.3");
188 $new_version = "1.2.3_4";
8cb289bd 189 diag "numeric tests with alpha-style non-objects" if $Verbose;
190 ok ( $version < $new_version, '$version < $new_version' );
191 ok ( $new_version > $version, '$new_version > $version' );
192 ok ( $version != $new_version, '$version != $new_version' );
317f7c8a 193
194 $version = $CLASS->new("1.2.4");
195 diag "numeric tests with alpha-style non-objects"
196 if $Verbose;
197 ok ( $version > $new_version, '$version > $new_version' );
198 ok ( $new_version < $version, '$new_version < $version' );
199 ok ( $version != $new_version, '$version != $new_version' );
200
201 # now test with alpha version form with object
202 $version = $CLASS->new("1.2.3");
203 $new_version = $CLASS->new("1.2.3_4");
204 diag "tests with alpha-style objects" if $Verbose;
205 ok ( $version < $new_version, '$version < $new_version' );
206 ok ( $new_version > $version, '$new_version > $version' );
207 ok ( $version != $new_version, '$version != $new_version' );
208 ok ( !$version->is_alpha, '!$version->is_alpha');
209 ok ( $new_version->is_alpha, '$new_version->is_alpha');
210
211 $version = $CLASS->new("1.2.4");
212 diag "tests with alpha-style objects" if $Verbose;
213 ok ( $version > $new_version, '$version > $new_version' );
214 ok ( $new_version < $version, '$new_version < $version' );
215 ok ( $version != $new_version, '$version != $new_version' );
216
217 $version = $CLASS->new("1.2.3.4");
218 $new_version = $CLASS->new("1.2.3_4");
219 diag "tests with alpha-style objects with same subversion"
220 if $Verbose;
221 ok ( $version > $new_version, '$version > $new_version' );
222 ok ( $new_version < $version, '$new_version < $version' );
223 ok ( $version != $new_version, '$version != $new_version' );
224
225 diag "test implicit [in]equality" if $Verbose;
226 $version = $CLASS->new("v1.2.3");
227 $new_version = $CLASS->new("1.2.3.0");
228 ok ( $version == $new_version, '$version == $new_version' );
229 $new_version = $CLASS->new("1.2.3_0");
230 ok ( $version == $new_version, '$version == $new_version' );
231 $new_version = $CLASS->new("1.2.3.1");
232 ok ( $version < $new_version, '$version < $new_version' );
233 $new_version = $CLASS->new("1.2.3_1");
234 ok ( $version < $new_version, '$version < $new_version' );
235 $new_version = $CLASS->new("1.1.999");
236 ok ( $version > $new_version, '$version > $new_version' );
237
238 # that which is not expressly permitted is forbidden
239 diag "forbidden operations" if $Verbose;
240 ok ( !eval { ++$version }, "noop ++" );
241 ok ( !eval { --$version }, "noop --" );
242 ok ( !eval { $version/1 }, "noop /" );
243 ok ( !eval { $version*3 }, "noop *" );
244 ok ( !eval { abs($version) }, "noop abs" );
137d6fc0 245
c8a14fb6 246SKIP: {
317f7c8a 247 skip "version require'd instead of use'd, cannot test qv", 3
248 if defined $no_qv;
249 # test the qv() sub
250 diag "testing qv" if $Verbose;
251 $version = qv("1.2");
8cb289bd 252 is ( "$version", "v1.2", 'qv("1.2") == "1.2.0"' );
317f7c8a 253 $version = qv(1.2);
8cb289bd 254 is ( "$version", "v1.2", 'qv(1.2) == "1.2.0"' );
317f7c8a 255 isa_ok( qv('5.008'), $CLASS );
c8a14fb6 256}
137d6fc0 257
317f7c8a 258 # test creation from existing version object
259 diag "create new from existing version" if $Verbose;
260 ok (eval {$new_version = $CLASS->new($version)},
261 "new from existing object");
262 ok ($new_version == $version, "class->new($version) identical");
263 $new_version = $version->new();
264 isa_ok ($new_version, $CLASS );
8cb289bd 265 is ($new_version, "0", "version->new() doesn't clone");
317f7c8a 266 $new_version = $version->new("1.2.3");
8cb289bd 267 is ($new_version, "1.2.3" , '$version->new("1.2.3") works too');
317f7c8a 268
269 # test the CVS revision mode
270 diag "testing CVS Revision" if $Verbose;
271 $version = new $CLASS qw$Revision: 1.2$;
8cb289bd 272 ok ( $version == "1.2.0", 'qw$Revision: 1.2$ == 1.2.0' );
317f7c8a 273 $version = new $CLASS qw$Revision: 1.2.3.4$;
8cb289bd 274 ok ( $version == "1.2.3.4", 'qw$Revision: 1.2.3.4$ == 1.2.3.4' );
317f7c8a 275
276 # test the CPAN style reduced significant digit form
277 diag "testing CPAN-style versions" if $Verbose;
278 $version = $CLASS->new("1.23_01");
8cb289bd 279 is ( "$version" , "1.23_01", "CPAN-style alpha version" );
317f7c8a 280 ok ( $version > 1.23, "1.23_01 > 1.23");
281 ok ( $version < 1.24, "1.23_01 < 1.24");
282
283 # test reformed UNIVERSAL::VERSION
284 diag "Replacement UNIVERSAL::VERSION tests" if $Verbose;
f34c6aaf 285
286 my $error_regex = $] < 5.006
287 ? 'version \d required'
288 : 'does not define \$...::VERSION';
317f7c8a 289
f34c6aaf 290 {
291 open F, ">aaa.pm" or die "Cannot open aaa.pm: $!\n";
292 print F "package aaa;\n\$aaa::VERSION=0.58;\n1;\n";
293 close F;
294
8cb289bd 295 $version = 0.58;
f34c6aaf 296 eval "use lib '.'; use aaa $version";
297 unlike($@, qr/aaa version $version/,
298 'Replacement eval works with exact version');
299
300 # test as class method
301 $new_version = "aaa"->VERSION;
8cb289bd 302 cmp_ok($new_version,'==',$version, "Called as class method");
8dd04980 303
f34c6aaf 304 eval "print Completely::Unknown::Module->VERSION";
305 if ( $] < 5.008 ) {
306 unlike($@, qr/$error_regex/,
307 "Don't freak if the module doesn't even exist");
308 }
309 else {
310 unlike($@, qr/defines neither package nor VERSION/,
311 "Don't freak if the module doesn't even exist");
312 }
313
314 # this should fail even with old UNIVERSAL::VERSION
8cb289bd 315 $version += 0.01;
f34c6aaf 316 eval "use lib '.'; use aaa $version";
317 like($@, qr/aaa version $version/,
318 'Replacement eval works with incremented version');
319
320 $version =~ s/0+$//; #convert to string and remove trailing 0's
321 chop($version); # shorten by 1 digit, should still succeed
322 eval "use lib '.'; use aaa $version";
323 unlike($@, qr/aaa version $version/,
324 'Replacement eval works with single digit');
325
326 # this would fail with old UNIVERSAL::VERSION
8cb289bd 327 $version += 0.1;
f34c6aaf 328 eval "use lib '.'; use aaa $version";
329 like($@, qr/aaa version $version/,
330 'Replacement eval works with incremented digit');
331 unlink 'aaa.pm';
332 }
317f7c8a 333
334 { # dummy up some variously broken modules for testing
335 open F, ">xxx.pm" or die "Cannot open xxx.pm: $!\n";
336 print F "1;\n";
337 close F;
f34c6aaf 338
339 eval "use lib '.'; use xxx 3;";
317f7c8a 340 if ( $] < 5.008 ) {
f34c6aaf 341 like($@, qr/$error_regex/,
342 'Replacement handles modules without package or VERSION');
c8a14fb6 343 }
317f7c8a 344 else {
f34c6aaf 345 like($@, qr/defines neither package nor VERSION/,
346 'Replacement handles modules without package or VERSION');
c8a14fb6 347 }
f34c6aaf 348 eval "use lib '.'; use xxx; \$version = xxx->VERSION";
317f7c8a 349 unlike ($@, qr/$error_regex/,
350 'Replacement handles modules without package or VERSION');
f34c6aaf 351 ok (!defined($version), "Called as class method");
317f7c8a 352 unlink 'xxx.pm';
353 }
354
355 { # dummy up some variously broken modules for testing
356 open F, ">yyy.pm" or die "Cannot open yyy.pm: $!\n";
357 print F "package yyy;\n#look ma no VERSION\n1;\n";
358 close F;
359 eval "use lib '.'; use yyy 3;";
f34c6aaf 360 like ($@, qr/$error_regex/,
317f7c8a 361 'Replacement handles modules without VERSION');
362 eval "use lib '.'; use yyy; print yyy->VERSION";
f34c6aaf 363 unlike ($@, qr/$error_regex/,
317f7c8a 364 'Replacement handles modules without VERSION');
365 unlink 'yyy.pm';
366 }
367
368 { # dummy up some variously broken modules for testing
369 open F, ">zzz.pm" or die "Cannot open zzz.pm: $!\n";
370 print F "package zzz;\n\@VERSION = ();\n1;\n";
371 close F;
372 eval "use lib '.'; use zzz 3;";
f34c6aaf 373 like ($@, qr/$error_regex/,
317f7c8a 374 'Replacement handles modules without VERSION');
375 eval "use lib '.'; use zzz; print zzz->VERSION";
f34c6aaf 376 unlike ($@, qr/$error_regex/,
317f7c8a 377 'Replacement handles modules without VERSION');
378 unlink 'zzz.pm';
379 }
380
137d6fc0 381SKIP: {
ac0e6a2f 382 skip 'Cannot test bare v-strings with Perl < 5.6.0', 4
383 if $] < 5.006_000;
317f7c8a 384 diag "Tests with v-strings" if $Verbose;
385 $version = $CLASS->new(1.2.3);
8cb289bd 386 ok("$version" == "v1.2.3", '"$version" == 1.2.3');
317f7c8a 387 $version = $CLASS->new(1.0.0);
388 $new_version = $CLASS->new(1);
389 ok($version == $new_version, '$version == $new_version');
317f7c8a 390 skip "version require'd instead of use'd, cannot test qv", 1
391 if defined $no_qv;
392 $version = qv(1.2.3);
8cb289bd 393 ok("$version" == "v1.2.3", 'v-string initialized qv()');
317f7c8a 394 }
395
396 diag "Tests with real-world (malformed) data" if $Verbose;
397
398 # trailing zero testing (reported by Andreas Koenig).
399 $version = $CLASS->new("1");
400 ok($version->numify eq "1.000", "trailing zeros preserved");
401 $version = $CLASS->new("1.0");
402 ok($version->numify eq "1.000", "trailing zeros preserved");
403 $version = $CLASS->new("1.0.0");
404 ok($version->numify eq "1.000000", "trailing zeros preserved");
405 $version = $CLASS->new("1.0.0.0");
406 ok($version->numify eq "1.000000000", "trailing zeros preserved");
407
408 # leading zero testing (reported by Andreas Koenig).
409 $version = $CLASS->new(".7");
410 ok($version->numify eq "0.700", "leading zero inferred");
411
412 # leading space testing (reported by Andreas Koenig).
413 $version = $CLASS->new(" 1.7");
414 ok($version->numify eq "1.700", "leading space ignored");
415
416 # RT 19517 - deal with undef and 'undef' initialization
8cb289bd 417 ok("$version" ne 'undef', "Undef version comparison #1");
418 ok("$version" ne undef, "Undef version comparison #2");
317f7c8a 419 $version = $CLASS->new('undef');
420 unlike($warning, qr/^Version string 'undef' contains invalid data/,
421 "Version string 'undef'");
422
423 $version = $CLASS->new(undef);
424 like($warning, qr/^Use of uninitialized value/,
425 "Version string 'undef'");
8cb289bd 426 ok($version == 'undef', "Undef version comparison #3");
427 ok($version == undef, "Undef version comparison #4");
317f7c8a 428 eval "\$version = \$CLASS->new()"; # no parameter at all
429 unlike($@, qr/^Bizarre copy of CODE/, "No initializer at all");
8cb289bd 430 ok($version == 'undef', "Undef version comparison #5");
431 ok($version == undef, "Undef version comparison #6");
317f7c8a 432
433 $version = $CLASS->new(0.000001);
434 unlike($warning, qr/^Version string '1e-06' contains invalid data/,
435 "Very small version objects");
f34c6aaf 436 }
e0218a61 437
317f7c8a 438SKIP: {
439 # dummy up a legal module for testing RT#19017
440 open F, ">www.pm" or die "Cannot open www.pm: $!\n";
441 print F <<"EOF";
c8a14fb6 442package www;
443use version; \$VERSION = qv('0.0.4');
4441;
445EOF
317f7c8a 446 close F;
447
448 eval "use lib '.'; use www 0.000008;";
ac0e6a2f 449 like ($@, qr/^www version 0.000008 required/,
317f7c8a 450 "Make sure very small versions don't freak");
451 eval "use lib '.'; use www 1;";
8cb289bd 452 like ($@, qr/^www version 1 required/,
317f7c8a 453 "Comparing vs. version with no decimal");
454 eval "use lib '.'; use www 1.;";
8cb289bd 455 like ($@, qr/^www version 1 required/,
317f7c8a 456 "Comparing vs. version with decimal only");
457
ac0e6a2f 458 if ( $] < 5.006_000 ) {
d69f6151 459 unlink 'www.pm';
ac0e6a2f 460 skip 'Cannot "use" extended versions with Perl < 5.6.0', 3;
d69f6151 461 }
ac0e6a2f 462 eval "use lib '.'; use www v0.0.8;";
463 my $regex = "^www version v0.0.8 required";
464 like ($@, qr/$regex/, "Make sure very small versions don't freak");
317f7c8a 465
ac0e6a2f 466 $regex =~ s/8/4/; # set for second test
467 eval "use lib '.'; use www v0.0.4;";
468 unlike($@, qr/$regex/, 'Succeed - required == VERSION');
8cb289bd 469 cmp_ok ( "www"->VERSION, 'eq', '0.0.4', 'No undef warnings' );
317f7c8a 470
471 unlink 'www.pm';
472 }
473
474 open F, ">vvv.pm" or die "Cannot open vvv.pm: $!\n";
475 print F <<"EOF";
92dcf8ce 476package vvv;
477use base qw(version);
4781;
479EOF
317f7c8a 480 close F;
481 # need to eliminate any other qv()'s
482 undef *main::qv;
483 ok(!defined(&{"main\::qv"}), "make sure we cleared qv() properly");
484 eval "use lib '.'; use vvv;";
485 ok(defined(&{"main\::qv"}), "make sure we exported qv() properly");
486 isa_ok( qv(1.2), "vvv");
487 unlink 'vvv.pm';
d69f6151 488
489SKIP: {
ac0e6a2f 490 if ( $] < 5.006_000 ) {
491 skip 'Cannot "use" extended versions with Perl < 5.6.0', 3;
492 }
493 open F, ">uuu.pm" or die "Cannot open uuu.pm: $!\n";
494 print F <<"EOF";
495package uuu;
496\$VERSION = 1.0;
4971;
498EOF
499 close F;
500 eval "use lib '.'; use uuu 1.001;";
501 like ($@, qr/^uuu version 1.001 required/,
502 "User typed numeric so we error with numeric");
503 eval "use lib '.'; use uuu v1.1.0;";
504 like ($@, qr/^uuu version v1.1.0 required/,
505 "User typed extended so we error with extended");
506 unlink 'uuu.pm';
507 }
508
509SKIP: {
d69f6151 510 # test locale handling
f34c6aaf 511 my $warning;
512 local $SIG{__WARN__} = sub { $warning = $_[0] };
d69f6151 513 my $ver = 1.23; # has to be floating point number
514 my $loc;
515 while (<DATA>) {
516 chomp;
517 $loc = POSIX::setlocale( &POSIX::LC_ALL, $_);
518 last if POSIX::localeconv()->{decimal_point} eq ',';
519 }
520 skip 'Cannot test locale handling without a comma locale', 4
521 unless ( $loc and ($ver eq '1,23') );
522
523 diag ("Testing locale handling with $loc") if $Verbose;
524
525 my $v = $CLASS->new($ver);
526 unlike($warning,qr/Version string '1,23' contains invalid data/,
527 "Process locale-dependent floating point");
8cb289bd 528 is ($v, "1.23", "Locale doesn't apply to version objects");
d69f6151 529 ok ($v == $ver, "Comparison to locale floating point");
530 }
f34c6aaf 531
532 eval 'my $v = $CLASS->new("1._1");';
533 unlike($@, qr/^Invalid version format \(alpha with zero width\)/,
534 "Invalid version format 1._1");
ac0e6a2f 535
137d6fc0 536}
cb5772bb 537
5381;
d69f6151 539
540__DATA__
541af_ZA
542af_ZA.utf8
543an_ES
544an_ES.utf8
545az_AZ.utf8
546be_BY
547be_BY.utf8
548bg_BG
549bg_BG.utf8
550br_FR
551br_FR@euro
552br_FR.utf8
553bs_BA
554bs_BA.utf8
555ca_ES
556ca_ES@euro
557ca_ES.utf8
558cs_CZ
559cs_CZ.utf8
560da_DK
561da_DK.utf8
562de_AT
563de_AT@euro
564de_AT.utf8
565de_BE
566de_BE@euro
567de_BE.utf8
568de_DE
569de_DE@euro
570de_DE.utf8
571de_LU
572de_LU@euro
573de_LU.utf8
574el_GR
575el_GR.utf8
576en_DK
577en_DK.utf8
578es_AR
579es_AR.utf8
580es_BO
581es_BO.utf8
582es_CL
583es_CL.utf8
584es_CO
585es_CO.utf8
586es_EC
587es_EC.utf8
588es_ES
589es_ES@euro
590es_ES.utf8
591es_PY
592es_PY.utf8
593es_UY
594es_UY.utf8
595es_VE
596es_VE.utf8
597et_EE
598et_EE.iso885915
599et_EE.utf8
600eu_ES
601eu_ES@euro
602eu_ES.utf8
603fi_FI
604fi_FI@euro
605fi_FI.utf8
606fo_FO
607fo_FO.utf8
608fr_BE
609fr_BE@euro
610fr_BE.utf8
611fr_CA
612fr_CA.utf8
613fr_CH
614fr_CH.utf8
615fr_FR
616fr_FR@euro
617fr_FR.utf8
618fr_LU
619fr_LU@euro
620fr_LU.utf8
621gl_ES
622gl_ES@euro
623gl_ES.utf8
624hr_HR
625hr_HR.utf8
626hu_HU
627hu_HU.utf8
628id_ID
629id_ID.utf8
630is_IS
631is_IS.utf8
632it_CH
633it_CH.utf8
634it_IT
635it_IT@euro
636it_IT.utf8
637ka_GE
638ka_GE.utf8
639kk_KZ
640kk_KZ.utf8
641kl_GL
642kl_GL.utf8
643lt_LT
644lt_LT.utf8
645lv_LV
646lv_LV.utf8
647mk_MK
648mk_MK.utf8
649mn_MN
650mn_MN.utf8
651nb_NO
652nb_NO.utf8
653nl_BE
654nl_BE@euro
655nl_BE.utf8
656nl_NL
657nl_NL@euro
658nl_NL.utf8
659nn_NO
660nn_NO.utf8
661no_NO
662no_NO.utf8
663oc_FR
664oc_FR.utf8
665pl_PL
666pl_PL.utf8
667pt_BR
668pt_BR.utf8
669pt_PT
670pt_PT@euro
671pt_PT.utf8
672ro_RO
673ro_RO.utf8
674ru_RU
675ru_RU.koi8r
676ru_RU.utf8
677ru_UA
678ru_UA.utf8
679se_NO
680se_NO.utf8
681sh_YU
682sh_YU.utf8
683sk_SK
684sk_SK.utf8
685sl_SI
686sl_SI.utf8
687sq_AL
688sq_AL.utf8
689sr_CS
690sr_CS.utf8
691sv_FI
692sv_FI@euro
693sv_FI.utf8
694sv_SE
695sv_SE.iso885915
696sv_SE.utf8
697tg_TJ
698tg_TJ.utf8
699tr_TR
700tr_TR.utf8
701tt_RU.utf8
702uk_UA
703uk_UA.utf8
704vi_VN
705vi_VN.tcvn
706wa_BE
707wa_BE@euro
708wa_BE.utf8
709