4 if ( $ENV{PERL_CORE} ) {
14 use Test::More tests => 25;
15 use App::Prove::State;
17 my $test_suite_data = test_suite_data();
20 # Test test suite results
23 can_ok 'App::Prove::State::Result', 'new';
24 isa_ok my $result = App::Prove::State::Result->new($test_suite_data),
25 'App::Prove::State::Result', '... and the object it returns';
27 ok $result, 'state_version';
28 ok defined $result->state_version, '... and it should be defined';
30 can_ok $result, 'generation';
31 is $result->generation, $test_suite_data->{generation},
32 '... and it should return the correct generation';
34 can_ok $result, 'num_tests';
35 is $result->num_tests, scalar keys %{ $test_suite_data->{tests} },
36 '... and it should return the number of tests run';
38 can_ok $result, 'raw';
39 is_deeply $result->raw, $test_suite_data,
40 '... and it should return the raw, unblessed data';
43 # Check individual tests.
46 can_ok $result, 'tests';
48 can_ok $result, 'test';
49 eval { $result->test };
51 like $error, qr/^\Qtest() requires a test name/,
52 '... and it should croak() if a test name is not supplied';
54 my $name = 't/compat/failure.t';
55 ok my $test = $result->test('t/compat/failure.t'),
56 'result() should succeed if the test name is found';
57 isa_ok $test, 'App::Prove::State::Result::Test',
58 '... and the object it returns';
61 is $test->name, $name, '... and it should return the test name';
63 can_ok $test, 'last_pass_time';
64 like $test->last_pass_time, qr/^\d+\.\d+$/,
65 '... and it should return a numeric value';
67 can_ok $test, 'last_fail_time';
68 ok !defined $test->last_fail_time,
69 '... and it should return undef if the test has never failed';
71 can_ok $result, 'remove';
72 ok $result->remove($name), '... and calling it should succeed';
74 ok $test = $result->test($name),
75 '... and fetching the removed test should suceed';
76 ok !defined $test->last_pass_time, '... and it should have clean values';
80 'version' => App::Prove::State::Result->state_version,
83 't/compat/failure.t' => {
85 'last_run_time' => '1196371471.57738',
86 'last_pass_time' => '1196371471.57738',
87 'total_passes' => '48',
92 'mtime' => 1196285623,
94 't/yamlish-writer.t' => {
96 'last_run_time' => '1196371480.5761',
97 'last_pass_time' => '1196371480.5761',
98 'last_fail_time' => '1196368609',
99 'total_passes' => '41',
102 'elapsed' => 12.2983,
104 'mtime' => 1196285400,
106 't/compat/env.t' => {
107 'last_result' => '0',
108 'last_run_time' => '1196371471.42967',
109 'last_pass_time' => '1196371471.42967',
110 'last_fail_time' => '1196368608',
111 'total_passes' => '48',
116 'mtime' => 1196285739,
118 't/compat/version.t' => {
119 'last_result' => '2',
120 'last_run_time' => '1196371472.96476',
121 'last_pass_time' => '1196371472.96476',
122 'last_fail_time' => '1196368609',
123 'total_passes' => '47',
128 'mtime' => 1196285239,
130 't/compat/inc_taint.t' => {
131 'last_result' => '3',
132 'last_run_time' => '1196371471.89682',
133 'last_pass_time' => '1196371471.89682',
134 'total_passes' => '47',
139 'mtime' => 1196185639,
142 'last_result' => '0',
143 'last_run_time' => '1196371479.72508',
144 'last_pass_time' => '1196371479.72508',
145 'total_passes' => '41',
150 'mtime' => 1186285639,