Commit | Line | Data |
b965d173 |
1 | #!/usr/bin/perl -w |
2 | |
69f36734 |
3 | BEGIN { |
2adbc9b6 |
4 | unshift @INC, 't/lib'; |
69f36734 |
5 | } |
b965d173 |
6 | |
69f36734 |
7 | use strict; |
b965d173 |
8 | use Test::More; |
9 | use App::Prove::State; |
27fc0087 |
10 | use App::Prove::State::Result; |
b965d173 |
11 | |
69f36734 |
12 | my @schedule = ( |
b965d173 |
13 | { options => 'all', |
14 | get_tests_args => [], |
15 | expect => [ |
16 | 't/compat/env.t', |
17 | 't/compat/failure.t', |
18 | 't/compat/inc_taint.t', |
19 | 't/compat/version.t', |
20 | 't/source.t', |
21 | 't/yamlish-writer.t', |
22 | ], |
23 | }, |
24 | { options => 'failed', |
25 | get_tests_args => [], |
26 | expect => [ |
27 | 't/compat/inc_taint.t', |
28 | 't/compat/version.t', |
29 | ], |
30 | }, |
31 | { options => 'passed', |
32 | get_tests_args => [], |
33 | expect => [ |
34 | 't/compat/env.t', |
35 | 't/compat/failure.t', |
36 | 't/source.t', |
37 | 't/yamlish-writer.t', |
38 | ], |
39 | }, |
40 | { options => 'last', |
41 | get_tests_args => [], |
42 | expect => [ |
43 | 't/compat/env.t', |
44 | 't/compat/failure.t', |
45 | 't/compat/inc_taint.t', |
46 | 't/compat/version.t', |
47 | 't/source.t', |
48 | ], |
49 | }, |
50 | { options => 'todo', |
51 | get_tests_args => [], |
52 | expect => [ |
53 | 't/compat/version.t', |
54 | 't/compat/failure.t', |
55 | ], |
56 | |
57 | }, |
58 | { options => 'hot', |
59 | get_tests_args => [], |
60 | expect => [ |
61 | 't/compat/version.t', |
62 | 't/yamlish-writer.t', |
63 | 't/compat/env.t', |
64 | ], |
65 | }, |
66 | { options => 'adrian', |
67 | get_tests_args => [], |
68 | expect => [ |
69 | 't/compat/version.t', |
70 | 't/yamlish-writer.t', |
71 | 't/compat/env.t', |
72 | 't/compat/failure.t', |
73 | 't/compat/inc_taint.t', |
74 | 't/source.t', |
75 | ], |
76 | }, |
77 | { options => 'failed,passed', |
78 | get_tests_args => [], |
79 | expect => [ |
80 | 't/compat/inc_taint.t', |
81 | 't/compat/version.t', |
82 | 't/compat/env.t', |
83 | 't/compat/failure.t', |
84 | 't/source.t', |
85 | 't/yamlish-writer.t', |
86 | ], |
87 | }, |
88 | { options => [ 'failed', 'passed' ], |
89 | get_tests_args => [], |
90 | expect => [ |
91 | 't/compat/inc_taint.t', |
92 | 't/compat/version.t', |
93 | 't/compat/env.t', |
94 | 't/compat/failure.t', |
95 | 't/source.t', |
96 | 't/yamlish-writer.t', |
97 | ], |
98 | }, |
99 | { options => 'slow', |
100 | get_tests_args => [], |
101 | expect => [ |
102 | 't/yamlish-writer.t', |
103 | 't/compat/env.t', |
104 | 't/compat/inc_taint.t', |
105 | 't/compat/version.t', |
106 | 't/compat/failure.t', |
107 | 't/source.t', |
108 | ], |
109 | }, |
110 | { options => 'fast', |
111 | get_tests_args => [], |
112 | expect => [ |
113 | 't/source.t', |
114 | 't/compat/failure.t', |
115 | 't/compat/version.t', |
116 | 't/compat/inc_taint.t', |
117 | 't/compat/env.t', |
118 | 't/yamlish-writer.t', |
119 | ], |
120 | }, |
121 | { options => 'old', |
122 | get_tests_args => [], |
123 | expect => [ |
69f36734 |
124 | 't/source.t', |
b965d173 |
125 | 't/compat/inc_taint.t', |
126 | 't/compat/version.t', |
b965d173 |
127 | 't/yamlish-writer.t', |
69f36734 |
128 | 't/compat/failure.t', |
129 | 't/compat/env.t', |
b965d173 |
130 | ], |
131 | }, |
132 | { options => 'new', |
133 | get_tests_args => [], |
134 | expect => [ |
b965d173 |
135 | 't/compat/env.t', |
136 | 't/compat/failure.t', |
69f36734 |
137 | 't/yamlish-writer.t', |
138 | 't/compat/version.t', |
139 | 't/compat/inc_taint.t', |
140 | 't/source.t', |
b965d173 |
141 | ], |
142 | }, |
27fc0087 |
143 | { options => 'fresh', |
144 | get_tests_args => [], |
145 | expect => [ |
146 | 't/compat/env.t', |
147 | 't/compat/failure.t', |
148 | ], |
149 | }, |
b965d173 |
150 | ); |
151 | |
152 | plan tests => @schedule * 2; |
153 | |
154 | for my $test (@schedule) { |
155 | my $state = App::Prove::State->new; |
156 | isa_ok $state, 'App::Prove::State'; |
157 | |
158 | my $desc = $test->{options}; |
159 | |
160 | # Naughty |
161 | $state->{_} = get_state(); |
162 | my $options = $test->{options}; |
163 | $options = [$options] unless 'ARRAY' eq ref $options; |
164 | $state->apply_switch(@$options); |
165 | |
69f36734 |
166 | my @got = $state->get_tests( @{ $test->{get_tests_args} } ); |
ff96ef94 |
167 | my @expect = @{ $test->{expect} }; |
69f36734 |
168 | unless ( is_deeply \@got, \@expect, "$desc: order OK" ) { |
b965d173 |
169 | use Data::Dumper; |
69f36734 |
170 | diag( Dumper( { got => \@got, want => \@expect } ) ); |
b965d173 |
171 | } |
172 | } |
173 | |
174 | sub get_state { |
27fc0087 |
175 | return App::Prove::State::Result->new( |
176 | { generation => 51, |
177 | last_run_time => 1196285439, |
178 | tests => { |
ff96ef94 |
179 | 't/compat/failure.t' => { |
27fc0087 |
180 | last_result => 0, |
181 | last_run_time => 1196371471.57738, |
182 | last_pass_time => 1196371471.57738, |
183 | total_passes => 48, |
184 | seq => 1549, |
185 | gen => 51, |
186 | elapsed => 0.1230, |
187 | last_todo => 1, |
188 | mtime => 1196285623, |
189 | }, |
ff96ef94 |
190 | 't/yamlish-writer.t' => { |
27fc0087 |
191 | last_result => 0, |
192 | last_run_time => 1196371480.5761, |
193 | last_pass_time => 1196371480.5761, |
194 | last_fail_time => 1196368609, |
195 | total_passes => 41, |
196 | seq => 1578, |
197 | gen => 49, |
198 | elapsed => 12.2983, |
199 | last_todo => 0, |
200 | mtime => 1196285400, |
201 | }, |
ff96ef94 |
202 | 't/compat/env.t' => { |
27fc0087 |
203 | last_result => 0, |
204 | last_run_time => 1196371471.42967, |
205 | last_pass_time => 1196371471.42967, |
206 | last_fail_time => 1196368608, |
207 | total_passes => 48, |
208 | seq => 1548, |
209 | gen => 52, |
210 | elapsed => 3.1290, |
211 | last_todo => 0, |
212 | mtime => 1196285739, |
213 | }, |
ff96ef94 |
214 | 't/compat/version.t' => { |
27fc0087 |
215 | last_result => 2, |
216 | last_run_time => 1196371472.96476, |
217 | last_pass_time => 1196371472.96476, |
218 | last_fail_time => 1196368609, |
219 | total_passes => 47, |
220 | seq => 1555, |
221 | gen => 51, |
222 | elapsed => 0.2363, |
223 | last_todo => 4, |
224 | mtime => 1196285239, |
225 | }, |
ff96ef94 |
226 | 't/compat/inc_taint.t' => { |
27fc0087 |
227 | last_result => 3, |
228 | last_run_time => 1196371471.89682, |
229 | last_pass_time => 1196371471.89682, |
230 | total_passes => 47, |
231 | seq => 1551, |
232 | gen => 51, |
233 | elapsed => 1.6938, |
234 | last_todo => 0, |
235 | mtime => 1196185639, |
236 | }, |
ff96ef94 |
237 | 't/source.t' => { |
27fc0087 |
238 | last_result => 0, |
239 | last_run_time => 1196371479.72508, |
240 | last_pass_time => 1196371479.72508, |
241 | total_passes => 41, |
242 | seq => 1570, |
243 | gen => 51, |
244 | elapsed => 0.0143, |
245 | last_todo => 0, |
246 | mtime => 1186285639, |
247 | }, |
248 | } |
b965d173 |
249 | } |
27fc0087 |
250 | ); |
b965d173 |
251 | } |