blob: cb5a6e34b06c1e040fbc47cd3d262c6803fe9606 (
plain)
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
|
use strict;
use warnings;
use Test::More;
use Test::Stream::Tester;
my $events = intercept {
local $TODO = "";
ok(0, "Should not be in todo 1");
local $TODO = 0;
ok(0, "Should not be in todo 2");
local $TODO = undef;
ok(0, "Should not be in todo 3");
local $TODO = "foo";
ok(0, "Should be in todo");
};
events_are(
$events,
check {
event ok => { in_todo => 0 };
event ok => { in_todo => 0 };
event ok => { in_todo => 0 };
event ok => { in_todo => 1 };
directive 'end';
},
"Verify TODO state"
);
my $i = 0;
for my $e (@$events) {
next if $e->context->in_todo;
my @tap = $e->to_tap(++$i);
my $ok_line = $tap[0];
chomp(my $text = $ok_line->[1]);
is($text, "not ok $i - Should not be in todo $i", "No TODO directive $i");
}
done_testing;
|