File: 02_release.t

package info (click to toggle)
libcpandb-perl 0.19-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 324 kB
  • sloc: perl: 628; makefile: 2
file content (143 lines) | stat: -rw-r--r-- 2,750 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/perl

use strict;
BEGIN {
	$|  = 1;
	$^W = 1;
}

use Test::More;
unless ( $ENV{RELEASE_TESTING} ) {
	plan( skip_all => "Author tests not required for installation" );
	exit(0);
}

plan( tests => 35 );

# Download and load the database
use_ok( 'CPANDB' );




######################################################################
# Age tracking

SCOPE: {
	my $latest = CPANDB->latest;
	like( $latest, qr/^\d\d\d\d-\d\d-\d\d$/, 'Got date' );
	my $datetime = CPANDB->latest_datetime;
	isa_ok( $datetime, 'DateTime' );
	my $age = CPANDB->age;
	ok(
		defined Params::Util::_NONNEGINT($age),
		'Got non-negative integer for ->age',
	);
	# diag("Age: $age days");
}





######################################################################
# CPANDB shortcuts

my $d = CPANDB->distribution('Config-Tiny');
isa_ok( $d, 'CPANDB::Distribution' );
isa_ok( $d->uploaded_datetime, 'DateTime' );
my $age = $d->age;
ok(
	defined Params::Util::_NONNEGINT($age),
	'Got non-negative integer for ->age',
);

my $author = CPANDB::Author->load('ADAMK');
isa_ok( $author, 'CPANDB::Author' );
my @dists = $author->distributions;
ok( scalar(@dists) > 100, 'Found lots of distributions' );





######################################################################
# Graph.pm Integration

eval {
	require Graph;
};
SKIP: {
	skip("No Graph support available", 3) if $@;

	# Graph generation for the entire grap
	SCOPE: {
		my $graph = CPANDB->graph;
		isa_ok( $graph, 'Graph::Directed' );
	}

	# Graph generation for a single distribution
	SCOPE: {
		my $graph1 = $d->dependency_graph;
		isa_ok( $graph1, 'Graph::Directed' );

		my $graph2 = $d->dependency_graph( phase => 'runtime' );
		isa_ok( $graph2, 'Graph::Directed' );
	}
}





######################################################################
# Graph::Easy Integration

eval {
	require Graph::Easy;
};
SKIP: {
	skip("No Graph::Easy support available", 1) if $@;

	# Graph::Easy generation for a single distribution
	SCOPE: {
		my $graph = $d->dependency_easy;
		isa_ok( $graph, 'Graph::Easy' );
	}
}





######################################################################
# GraphViz Integration

eval {
	require GraphViz;
};
SKIP: {
	skip("No GraphViz support available", 1) if $@;

	# GraphViz generation for a single distribution
	SCOPE: {
		my $graph = $d->dependency_graphviz;
		isa_ok( $graph, 'GraphViz' );
	}
}





######################################################################
# Quadrant Support

SCOPE: {
	my @latest = CPANDB::Distribution->select("order by uploaded desc limit 10");
	is( scalar(@latest), 10, 'Found the 10 latest results' );
	foreach ( @latest ) {
		isa_ok( $_, 'CPANDB::Distribution' );
		is( $_->quartile, 1, $_->distribution . ' is in quartile 1' );
	}
}