Hack to remove insecure directories from PATH so test will run.
[p5sagit/p5-mst-13.2.git] / t / lib / cpan-vcmp.t
1 # -*- Mode: cperl; coding: utf-8; -*-
2
3 BEGIN {
4         chdir 't' if -d 't';
5         @INC = '../lib';
6 }
7
8 use strict;
9 use CPAN;
10 use vars qw($D $N);
11
12 while (<DATA>) {
13   next if /^v/ && $]<5.006; # v-string tests are not for pre-5.6.0
14   chomp;
15   s/\s*#.*//;
16   push @$D, [ split ];
17 }
18
19 $N = scalar @$D;
20 print "1..$N\n";
21
22 while (@$D) {
23   my($l,$r,$exp) = @{shift @$D};
24   my $res = CPAN::Version->vcmp($l,$r);
25   if ($res != $exp){
26     print "# l[$l]r[$r]exp[$exp]res[$res]\n";
27     print "not ";
28   }
29   print "ok ", $N-@$D, "\n";
30 }
31
32 __END__
33 0 0 0
34 1 0 1
35 0 1 -1
36 1 1 0
37 1.1 0.0a 1
38 1.1a 0.0 1
39 1.2.3 1.1.1 1
40 v1.2.3 v1.1.1 1
41 v1.2.3 v1.2.1 1
42 v1.2.3 v1.2.11 -1
43 1.2.3 1.2.11 1 # not what they wanted
44 1.9 1.10 1
45 VERSION VERSION 0
46 0.02 undef 1
47 1.57_00 1.57 1
48 1.5700 1.57 1
49 1.57_01 1.57 1
50 0.2.10 0.2 1
51 20000000.00 19990108 1
52 1.00 0.96 1
53 0.7.02 0.7 1
54 1.3a5 1.3 1
55 undef 1.00 -1
56 v1.0 undef 1
57 v0.2.4 0.24 -1
58 v1.0.22 122 -1
59 5.00556 v5.5.560 0
60 5.005056 v5.5.56 0
61 5.00557 v5.5.560 1
62 5.00056 v5.0.561 -1