jeudi 15 mars 2018

Why *STDERR in this perl test is empty?

I have the following chunk of code copied from Mojolicious (mojo/log.t). The application which I am testing does $app->log->warn('whatever');. Unfortunately when I run the test as part of make test, STDERR happens to be empty. When I run it with prove -lv t/basic.t it succeeds. What's wrong with my program. Full source code of the tested program is here Thank you!

my $buffer = '';
{
  $ENV{MOJO_HOME} = "$FindBin::Bin/blog";
  open my $handle, '>', \$buffer;
  local *STDERR = $handle;
  require Blog;
  my $blog = Blog->new;
  $blog->startup();
}
like $buffer, qr/"routes" key must point to an ARRAY/,
  'right warning about ARRAY reference';

Aucun commentaire:

Enregistrer un commentaire