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'
5 #########################
7 use Test::More qw(no_plan);
11 *Verbose = \$Test::Harness::Verbose;
12 use POSIX qw/locale_h/;
13 use File::Temp qw/tempfile/;
17 use_ok("version", 0.77);
18 # If we made it this far, we are ok.
23 diag "Tests with base class" unless $ENV{PERL_CORE};
25 BaseTests("version","new","qv");
26 BaseTests("version","new","declare");
27 BaseTests("version","parse", "qv");
28 BaseTests("version","parse", "declare");
30 # dummy up a redundant call to satify David Wheeler
31 local $SIG{__WARN__} = sub { die $_[0] };
33 unlike ($@, qr/^Subroutine main::declare redefined/,
34 "Only export declare once per package (to prevent redefined warnings).");
38 sub new { my($self,$n)=@_; bless \$n, $self }
43 local $SIG{__WARN__} = sub { $warning = $_[0] };
44 my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1);
45 (my $package = basename($filename)) =~ s/\.pm$//;
47 # This is an empty subclass
56 delete $main::INC{'$package'};
57 undef &qv; undef *::qv; # avoid 'used once' warning
58 undef &declare; undef *::declare; # avoid 'used once' warning
61 diag "Tests with empty derived class" unless $ENV{PERL_CORE};
63 use_ok($package, 0.001);
64 my $testobj = $package->new(1.002_003);
65 isa_ok( $testobj, $package );
66 ok( $testobj->numify == 1.002003, "Numified correctly" );
67 ok( $testobj->stringify eq "1.002003", "Stringified correctly" );
68 ok( $testobj->normal eq "v1.2.3", "Normalified correctly" );
70 my $verobj = version::->new("1.2.4");
71 ok( $verobj > $testobj, "Comparison vs parent class" );
73 BaseTests($package, "new", "qv");
75 use_ok($package, 0.001, "declare");
76 BaseTests($package, "new", "declare");
78 use_ok($package, 0.001);
79 BaseTests($package, "parse", "qv");
81 use_ok($package, 0.001, "declare");
82 BaseTests($package, "parse", "declare");
84 diag "tests with bad subclass" unless $ENV{PERL_CORE};
85 $testobj = version::Bad->new(1.002_003);
86 isa_ok( $testobj, "version::Bad" );
87 eval { my $string = $testobj->numify };
88 like($@, qr/Invalid version object/,
89 "Bad subclass numify");
90 eval { my $string = $testobj->normal };
91 like($@, qr/Invalid version object/,
92 "Bad subclass normal");
93 eval { my $string = $testobj->stringify };
94 like($@, qr/Invalid version object/,
95 "Bad subclass stringify");
96 eval { my $test = ($testobj > 1.0) };
97 like($@, qr/Invalid version object/,
101 # do strict lax tests in a sub to isolate a package to test importing
102 sub strict_lax_tests {
104 # copied from perl core test t/op/packagev.t
105 # format: STRING STRICT_OK LAX_OK
106 my $strict_lax_data = << 'CASE_DATA';
153 version->import( qw/is_strict is_lax/ );
154 for my $case ( split qr/\n/, $strict_lax_data ) {
155 my ($v, $strict, $lax) = split qr/\t+/, $case;
156 main::ok( $strict eq 'pass' ? is_strict($v) : ! is_strict($v), "is_strict($v) [$strict]" );
157 main::ok( $strict eq 'pass' ? version::is_strict($v) : ! version::is_strict($v), "version::is_strict($v) [$strict]" );
158 main::ok( $lax eq 'pass' ? is_lax($v) : ! is_lax($v), "is_lax($v) [$lax]" );
159 main::ok( $lax eq 'pass' ? version::is_lax($v) : ! version::is_lax($v), "version::is_lax($v) [$lax]" );
165 my ($CLASS, $method, $qv_declare) = @_;
167 local $SIG{__WARN__} = sub { $warning = $_[0] };
169 # Insert your test code below, the Test module is use()ed here so read
170 # its man page ( perldoc Test ) for help writing this test script.
172 # Test bare number processing
173 diag "tests with bare numbers" unless $ENV{PERL_CORE};
174 $version = $CLASS->$method(5.005_03);
175 is ( "$version" , "5.00503" , '5.005_03 eq 5.00503' );
176 $version = $CLASS->$method(1.23);
177 is ( "$version" , "1.23" , '1.23 eq "1.23"' );
179 # Test quoted number processing
180 diag "tests with quoted numbers" unless $ENV{PERL_CORE};
181 $version = $CLASS->$method("5.005_03");
182 is ( "$version" , "5.005_03" , '"5.005_03" eq "5.005_03"' );
183 $version = $CLASS->$method("v1.23");
184 is ( "$version" , "v1.23" , '"v1.23" eq "v1.23"' );
186 # Test stringify operator
187 diag "tests with stringify" unless $ENV{PERL_CORE};
188 $version = $CLASS->$method("5.005");
189 is ( "$version" , "5.005" , '5.005 eq "5.005"' );
190 $version = $CLASS->$method("5.006.001");
191 is ( "$version" , "5.006.001" , '5.006.001 eq v5.6.1' );
192 unlike ($warning, qr/v-string without leading 'v' deprecated/, 'No leading v');
193 $version = $CLASS->$method("v1.2.3_4");
194 is ( "$version" , "v1.2.3_4" , 'alpha version 1.2.3_4 eq v1.2.3_4' );
196 # test illegal formats
197 diag "test illegal formats" unless $ENV{PERL_CORE};
198 eval {$version = $CLASS->$method("1.2_3_4")};
199 like($@, qr/multiple underscores/,
200 "Invalid version format (multiple underscores)");
202 eval {$version = $CLASS->$method("1.2_3.4")};
203 like($@, qr/underscores before decimal/,
204 "Invalid version format (underscores before decimal)");
206 eval {$version = $CLASS->$method("1_2")};
207 like($@, qr/alpha without decimal/,
208 "Invalid version format (alpha without decimal)");
210 eval { $version = $CLASS->$method("1.2b3")};
211 like($@, qr/non-numeric data/,
212 "Invalid version format (non-numeric data)");
214 # from here on out capture the warning and test independently
216 eval{$version = $CLASS->$method("99 and 44/100 pure")};
218 like($@, qr/non-numeric data/,
219 "Invalid version format (non-numeric data)");
221 eval{$version = $CLASS->$method("something")};
222 like($@, qr/non-numeric data/,
223 "Invalid version format (non-numeric data)");
225 # reset the test object to something reasonable
226 $version = $CLASS->$method("1.2.3");
228 # Test boolean operator
229 ok ($version, 'boolean');
231 # Test class membership
232 isa_ok ( $version, $CLASS );
234 # Test comparison operators with self
235 diag "tests with self" unless $ENV{PERL_CORE};
236 is ( $version <=> $version, 0, '$version <=> $version == 0' );
237 ok ( $version == $version, '$version == $version' );
239 # Test Numeric Comparison operators
240 # test first with non-object
241 $version = $CLASS->$method("5.006.001");
242 $new_version = "5.8.0";
243 diag "numeric tests with non-objects" unless $ENV{PERL_CORE};
244 ok ( $version == $version, '$version == $version' );
245 ok ( $version < $new_version, '$version < $new_version' );
246 ok ( $new_version > $version, '$new_version > $version' );
247 ok ( $version != $new_version, '$version != $new_version' );
249 # now test with existing object
250 $new_version = $CLASS->$method($new_version);
251 diag "numeric tests with objects" unless $ENV{PERL_CORE};
252 ok ( $version < $new_version, '$version < $new_version' );
253 ok ( $new_version > $version, '$new_version > $version' );
254 ok ( $version != $new_version, '$version != $new_version' );
256 # now test with actual numbers
257 diag "numeric tests with numbers" unless $ENV{PERL_CORE};
258 ok ( $version->numify() == 5.006001, '$version->numify() == 5.006001' );
259 ok ( $version->numify() <= 5.006001, '$version->numify() <= 5.006001' );
260 ok ( $version->numify() < 5.008, '$version->numify() < 5.008' );
261 #ok ( $version->numify() > v5.005_02, '$version->numify() > 5.005_02' );
263 # test with long decimals
264 diag "Tests with extended decimal versions" unless $ENV{PERL_CORE};
265 $version = $CLASS->$method(1.002003);
266 ok ( $version == "1.2.3", '$version == "1.2.3"');
267 ok ( $version->numify == 1.002003, '$version->numify == 1.002003');
268 $version = $CLASS->$method("2002.09.30.1");
269 ok ( $version == "2002.9.30.1",'$version == 2002.9.30.1');
270 ok ( $version->numify == 2002.009030001,
271 '$version->numify == 2002.009030001');
273 # now test with alpha version form with string
274 $version = $CLASS->$method("1.2.3");
275 $new_version = "1.2.3_4";
276 diag "numeric tests with alpha-style non-objects" unless $ENV{PERL_CORE};
277 ok ( $version < $new_version, '$version < $new_version' );
278 ok ( $new_version > $version, '$new_version > $version' );
279 ok ( $version != $new_version, '$version != $new_version' );
281 $version = $CLASS->$method("1.2.4");
282 diag "numeric tests with alpha-style non-objects"
283 unless $ENV{PERL_CORE};
284 ok ( $version > $new_version, '$version > $new_version' );
285 ok ( $new_version < $version, '$new_version < $version' );
286 ok ( $version != $new_version, '$version != $new_version' );
288 # now test with alpha version form with object
289 $version = $CLASS->$method("1.2.3");
290 $new_version = $CLASS->$method("1.2.3_4");
291 diag "tests with alpha-style objects" unless $ENV{PERL_CORE};
292 ok ( $version < $new_version, '$version < $new_version' );
293 ok ( $new_version > $version, '$new_version > $version' );
294 ok ( $version != $new_version, '$version != $new_version' );
295 ok ( !$version->is_alpha, '!$version->is_alpha');
296 ok ( $new_version->is_alpha, '$new_version->is_alpha');
298 $version = $CLASS->$method("1.2.4");
299 diag "tests with alpha-style objects" unless $ENV{PERL_CORE};
300 ok ( $version > $new_version, '$version > $new_version' );
301 ok ( $new_version < $version, '$new_version < $version' );
302 ok ( $version != $new_version, '$version != $new_version' );
304 $version = $CLASS->$method("1.2.3.4");
305 $new_version = $CLASS->$method("1.2.3_4");
306 diag "tests with alpha-style objects with same subversion"
307 unless $ENV{PERL_CORE};
308 ok ( $version > $new_version, '$version > $new_version' );
309 ok ( $new_version < $version, '$new_version < $version' );
310 ok ( $version != $new_version, '$version != $new_version' );
312 diag "test implicit [in]equality" unless $ENV{PERL_CORE};
313 $version = $CLASS->$method("v1.2.3");
314 $new_version = $CLASS->$method("1.2.3.0");
315 ok ( $version == $new_version, '$version == $new_version' );
316 $new_version = $CLASS->$method("1.2.3_0");
317 ok ( $version == $new_version, '$version == $new_version' );
318 $new_version = $CLASS->$method("1.2.3.1");
319 ok ( $version < $new_version, '$version < $new_version' );
320 $new_version = $CLASS->$method("1.2.3_1");
321 ok ( $version < $new_version, '$version < $new_version' );
322 $new_version = $CLASS->$method("1.1.999");
323 ok ( $version > $new_version, '$version > $new_version' );
325 # that which is not expressly permitted is forbidden
326 diag "forbidden operations" unless $ENV{PERL_CORE};
327 ok ( !eval { ++$version }, "noop ++" );
328 ok ( !eval { --$version }, "noop --" );
329 ok ( !eval { $version/1 }, "noop /" );
330 ok ( !eval { $version*3 }, "noop *" );
331 ok ( !eval { abs($version) }, "noop abs" );
334 skip "version require'd instead of use'd, cannot test $qv_declare", 3
335 unless defined $qv_declare;
336 # test the $qv_declare() sub
337 diag "testing $qv_declare" unless $ENV{PERL_CORE};
338 $version = $CLASS->$qv_declare("1.2");
339 is ( "$version", "v1.2", $qv_declare.'("1.2") == "1.2.0"' );
340 $version = $CLASS->$qv_declare(1.2);
341 is ( "$version", "v1.2", $qv_declare.'(1.2) == "1.2.0"' );
342 isa_ok( $CLASS->$qv_declare('5.008'), $CLASS );
345 # test creation from existing version object
346 diag "create new from existing version" unless $ENV{PERL_CORE};
347 ok (eval {$new_version = $CLASS->$method($version)},
348 "new from existing object");
349 ok ($new_version == $version, "class->$method($version) identical");
350 $new_version = $version->$method();
351 isa_ok ($new_version, $CLASS );
352 is ($new_version, "0", "version->$method() doesn't clone");
353 $new_version = $version->$method("1.2.3");
354 is ($new_version, "1.2.3" , '$version->$method("1.2.3") works too');
356 # test the CVS revision mode
357 diag "testing CVS Revision" unless $ENV{PERL_CORE};
358 $version = new $CLASS qw$Revision: 1.2$;
359 ok ( $version == "1.2.0", 'qw$Revision: 1.2$ == 1.2.0' );
360 $version = new $CLASS qw$Revision: 1.2.3.4$;
361 ok ( $version == "1.2.3.4", 'qw$Revision: 1.2.3.4$ == 1.2.3.4' );
363 # test the CPAN style reduced significant digit form
364 diag "testing CPAN-style versions" unless $ENV{PERL_CORE};
365 $version = $CLASS->$method("1.23_01");
366 is ( "$version" , "1.23_01", "CPAN-style alpha version" );
367 ok ( $version > 1.23, "1.23_01 > 1.23");
368 ok ( $version < 1.24, "1.23_01 < 1.24");
370 # test reformed UNIVERSAL::VERSION
371 diag "Replacement UNIVERSAL::VERSION tests" unless $ENV{PERL_CORE};
373 my $error_regex = $] < 5.006
374 ? 'version \d required'
375 : 'does not define \$t.{7}::VERSION';
378 my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1);
379 (my $package = basename($filename)) =~ s/\.pm$//;
380 print $fh "package $package;\n\$$package\::VERSION=0.58;\n1;\n";
384 eval "use lib '.'; use $package $version";
385 unlike($@, qr/$package version $version/,
386 'Replacement eval works with exact version');
388 # test as class method
389 $new_version = $package->VERSION;
390 cmp_ok($new_version,'==',$version, "Called as class method");
392 eval "print Completely::Unknown::Module->VERSION";
394 unlike($@, qr/$error_regex/,
395 "Don't freak if the module doesn't even exist");
398 unlike($@, qr/defines neither package nor VERSION/,
399 "Don't freak if the module doesn't even exist");
402 # this should fail even with old UNIVERSAL::VERSION
404 eval "use lib '.'; use $package $version";
405 like($@, qr/$package version $version/,
406 'Replacement eval works with incremented version');
408 $version =~ s/0+$//; #convert to string and remove trailing 0's
409 chop($version); # shorten by 1 digit, should still succeed
410 eval "use lib '.'; use $package $version";
411 unlike($@, qr/$package version $version/,
412 'Replacement eval works with single digit');
414 # this would fail with old UNIVERSAL::VERSION
416 eval "use lib '.'; use $package $version";
417 like($@, qr/$package version $version/,
418 'Replacement eval works with incremented digit');
422 { # dummy up some variously broken modules for testing
423 my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1);
424 (my $package = basename($filename)) =~ s/\.pm$//;
428 eval "use lib '.'; use $package 3;";
430 like($@, qr/$error_regex/,
431 'Replacement handles modules without package or VERSION');
434 like($@, qr/defines neither package nor VERSION/,
435 'Replacement handles modules without package or VERSION');
437 eval "use lib '.'; use $package; \$version = $package->VERSION";
438 unlike ($@, qr/$error_regex/,
439 'Replacement handles modules without package or VERSION');
440 ok (!defined($version), "Called as class method");
444 { # dummy up some variously broken modules for testing
445 my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1);
446 (my $package = basename($filename)) =~ s/\.pm$//;
447 print $fh "package $package;\n#look ma no VERSION\n1;\n";
449 eval "use lib '.'; use $package 3;";
450 like ($@, qr/$error_regex/,
451 'Replacement handles modules without VERSION');
452 eval "use lib '.'; use $package; print $package->VERSION";
453 unlike ($@, qr/$error_regex/,
454 'Replacement handles modules without VERSION');
458 { # dummy up some variously broken modules for testing
459 my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1);
460 (my $package = basename($filename)) =~ s/\.pm$//;
461 print $fh "package $package;\n\@VERSION = ();\n1;\n";
463 eval "use lib '.'; use $package 3;";
464 like ($@, qr/$error_regex/,
465 'Replacement handles modules without VERSION');
466 eval "use lib '.'; use $package; print $package->VERSION";
467 unlike ($@, qr/$error_regex/,
468 'Replacement handles modules without VERSION');
473 skip 'Cannot test bare v-strings with Perl < 5.6.0', 4
475 diag "Tests with v-strings" unless $ENV{PERL_CORE};
476 $version = $CLASS->$method(1.2.3);
477 ok("$version" == "v1.2.3", '"$version" == 1.2.3');
478 $version = $CLASS->$method(1.0.0);
479 $new_version = $CLASS->$method(1);
480 ok($version == $new_version, '$version == $new_version');
481 skip "version require'd instead of use'd, cannot test declare", 1
482 unless defined $qv_declare;
483 $version = &$qv_declare(1.2.3);
484 ok("$version" == "v1.2.3", 'v-string initialized $qv_declare()');
487 diag "Tests with real-world (malformed) data" unless $ENV{PERL_CORE};
489 # trailing zero testing (reported by Andreas Koenig).
490 $version = $CLASS->$method("1");
491 ok($version->numify eq "1.000", "trailing zeros preserved");
492 $version = $CLASS->$method("1.0");
493 ok($version->numify eq "1.000", "trailing zeros preserved");
494 $version = $CLASS->$method("1.0.0");
495 ok($version->numify eq "1.000000", "trailing zeros preserved");
496 $version = $CLASS->$method("1.0.0.0");
497 ok($version->numify eq "1.000000000", "trailing zeros preserved");
499 # leading zero testing (reported by Andreas Koenig).
500 $version = $CLASS->$method(".7");
501 ok($version->numify eq "0.700", "leading zero inferred");
503 # leading space testing (reported by Andreas Koenig).
504 $version = $CLASS->$method(" 1.7");
505 ok($version->numify eq "1.700", "leading space ignored");
507 # RT 19517 - deal with undef and 'undef' initialization
508 ok("$version" ne 'undef', "Undef version comparison #1");
509 ok("$version" ne undef, "Undef version comparison #2");
510 $version = $CLASS->$method('undef');
511 unlike($warning, qr/^Version string 'undef' contains invalid data/,
512 "Version string 'undef'");
514 $version = $CLASS->$method(undef);
515 like($warning, qr/^Use of uninitialized value/,
516 "Version string 'undef'");
517 ok($version == 'undef', "Undef version comparison #3");
518 ok($version == undef, "Undef version comparison #4");
519 eval "\$version = \$CLASS->$method()"; # no parameter at all
520 unlike($@, qr/^Bizarre copy of CODE/, "No initializer at all");
521 ok($version == 'undef', "Undef version comparison #5");
522 ok($version == undef, "Undef version comparison #6");
524 $version = $CLASS->$method(0.000001);
525 unlike($warning, qr/^Version string '1e-06' contains invalid data/,
526 "Very small version objects");
531 local $SIG{__WARN__} = sub { $warning = $_[0] };
532 # dummy up a legal module for testing RT#19017
533 my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1);
534 (my $package = basename($filename)) =~ s/\.pm$//;
537 use $CLASS; \$VERSION = ${CLASS}->new('0.0.4');
542 eval "use lib '.'; use $package 0.000008;";
543 like ($@, qr/^$package version 0.000008 required/,
544 "Make sure very small versions don't freak");
545 eval "use lib '.'; use $package 1;";
546 like ($@, qr/^$package version 1 required/,
547 "Comparing vs. version with no decimal");
548 eval "use lib '.'; use $package 1.;";
549 like ($@, qr/^$package version 1 required/,
550 "Comparing vs. version with decimal only");
551 if ( $] < 5.006_000 ) {
552 skip 'Cannot "use" extended versions with Perl < 5.6.0', 3;
554 eval "use lib '.'; use $package v0.0.8;";
555 my $regex = "^$package version v0.0.8 required";
556 like ($@, qr/$regex/, "Make sure very small versions don't freak");
558 $regex =~ s/8/4/; # set for second test
559 eval "use lib '.'; use $package v0.0.4;";
560 unlike($@, qr/$regex/, 'Succeed - required == VERSION');
561 cmp_ok ( $package->VERSION, 'eq', '0.0.4', 'No undef warnings' );
566 skip 'Cannot test "use base qw(version)" when require is used', 3
567 unless defined $qv_declare;
568 my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1);
569 (my $package = basename($filename)) =~ s/\.pm$//;
572 use base qw(version);
576 # need to eliminate any other $qv_declare()'s
577 undef *{"main\::$qv_declare"};
578 ok(!defined(&{"main\::$qv_declare"}), "make sure we cleared $qv_declare() properly");
579 eval "use lib '.'; use $package qw/declare qv/;";
580 ok(defined(&{"main\::$qv_declare"}), "make sure we exported $qv_declare() properly");
581 isa_ok( &$qv_declare(1.2), $package);
586 if ( $] < 5.006_000 ) {
587 skip 'Cannot "use" extended versions with Perl < 5.6.0', 3;
589 my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1);
590 (my $package = basename($filename)) =~ s/\.pm$//;
597 eval "use lib '.'; use $package 1.001;";
598 like ($@, qr/^$package version 1.001 required/,
599 "User typed numeric so we error with numeric");
600 eval "use lib '.'; use $package v1.1.0;";
601 like ($@, qr/^$package version v1.1.0 required/,
602 "User typed extended so we error with extended");
607 # test locale handling
609 local $SIG{__WARN__} = sub { $warning = $_[0] };
612 my $v = eval { $CLASS->$method('1,7') };
613 # is( $@, "", 'Directly test comma as decimal compliance');
615 my $ver = 1.23; # has to be floating point number
616 my $orig_loc = setlocale( LC_ALL );
620 $loc = setlocale( LC_ALL, $_);
621 last if localeconv()->{decimal_point} eq ',';
623 skip 'Cannot test locale handling without a comma locale', 4
624 unless ( $loc and ($ver eq '1,23') );
626 diag ("Testing locale handling with $loc") unless $ENV{PERL_CORE};
628 $v = $CLASS->$method($ver);
629 unlike($warning, qr/Version string '1,23' contains invalid data/,
630 "Process locale-dependent floating point");
631 is ($v, "1.23", "Locale doesn't apply to version objects");
632 ok ($v == $ver, "Comparison to locale floating point");
634 setlocale( LC_ALL, $orig_loc); # reset this before possible skip
635 skip 'Cannot test RT#46921 with Perl < 5.008', 1
637 skip 'Cannot test RT#46921 with pure Perl module', 1
638 if exists $INC{'version/vpp.pm'};
639 my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1);
640 (my $package = basename($filename)) =~ s/\.pm$//;
643 use POSIX qw(locale_h);
646 setlocale (LC_ALL, '$loc');
648 eval "use Socket 1.7";
649 setlocale( LC_ALL, '$orig_loc');
654 eval "use lib '.'; use $package;";
655 unlike($warning, qr"Version string '1,7' contains invalid data",
656 'Handle locale action-at-a-distance');
659 eval 'my $v = $CLASS->$method("1._1");';
660 unlike($@, qr/^Invalid version format \(alpha with zero width\)/,
661 "Invalid version format 1._1");
665 local $SIG{__WARN__} = sub { $warning = $_[0] };
666 eval 'my $v = $CLASS->$method(~0);';
667 unlike($@, qr/Integer overflow in version/, "Too large version");
668 like($warning, qr/Integer overflow in version/, "Too large version");
672 # http://rt.cpan.org/Public/Bug/Display.html?id=30004
673 my $v1 = $CLASS->$method("v0.1_1");
674 (my $alpha1 = Dumper($v1)) =~ s/.+'alpha' => ([^,]+),.+/$1/ms;
675 my $v2 = $CLASS->$method($v1);
676 (my $alpha2 = Dumper($v2)) =~ s/.+'alpha' => ([^,]+),.+/$1/ms;
677 is $alpha2, $alpha1, "Don't fall for Data::Dumper's tricks";
681 # http://rt.perl.org/rt3/Ticket/Display.html?id=56606
682 my $badv = bless { version => [1,2,3] }, "version";
683 is $badv, '1.002003', "Deal with badly serialized versions from YAML";
684 my $badv2 = bless { qv => 1, version => [1,2,3] }, "version";
685 is $badv2, 'v1.2.3', "Deal with badly serialized versions from YAML ";