diff options
Diffstat (limited to 'cpan/Test-Simple/t/Legacy/ribasushi_diag.t')
-rw-r--r-- | cpan/Test-Simple/t/Legacy/ribasushi_diag.t | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/cpan/Test-Simple/t/Legacy/ribasushi_diag.t b/cpan/Test-Simple/t/Legacy/ribasushi_diag.t new file mode 100644 index 0000000000..570ee5159b --- /dev/null +++ b/cpan/Test-Simple/t/Legacy/ribasushi_diag.t @@ -0,0 +1,59 @@ +use strict; +use warnings; + +use Test::More; + +BEGIN { + my $has_module = eval { require SQL::Abstract::Test; 1 }; + my $required = $ENV{AUTHOR_TESTING}; + + if ($required && !$has_module) { + die "This test requires 'SQL::Abstract::Test' to be installed when AUTHOR_TESTING.\n"; + } + + unless($required) { + plan skip_all => "Only run when AUTHOR_TESTING is set"; + } +} + +{ + package Worker; + + sub do_work { + local $Test::Builder::Level = $Test::Builder::Level + 2; + shift->(); + } +} + +use SQL::Abstract::Test; +use Test::Stream::Tester; + +my $events = intercept { + local $TODO = "Not today"; + + Worker::do_work( + sub { + SQL::Abstract::Test::is_same_sql_bind( + 'buh', [], + 'bah', [1], + ); + } + ); +}; + +ok( !(grep { $_->context->in_todo ? 0 : 1 } @{$events->[0]->diag}), "All diag is todo" ); + +events_are( + $events, + check { + event ok => { + in_todo => 1, + }; + event note => { in_todo => 1 }; + event note => { in_todo => 1 }; + dir 'end'; + }, + "All events are TODO" +); + +done_testing; |