in reply to getting is_deeply test::more to print to log

Print to a log file:

#!/usr/bin/perl use strict; use warnings; use Test::More; my @valid = qw/ foo bar baz /; my @compare = qw/ foo qux baz /; my $log_file = 'log.txt'; my $err_file = 'err.txt'; Test::More->builder->output( $log_file ); Test::More->builder->failure_output( $err_file ); is_deeply( \@compare, \@valid, 'My Test' ); done_testing; __END__
$ cat log.txt not ok 1 - My Test 1..1 $
$ cat err.txt # Failed test 'My Test' # at 1140351.pl line 17. # Structures begin differing at: # $got->[1] = 'qux' # $expected->[1] = 'bar' # Looks like you failed 1 test of 1. $

E-mail from there would be up to you, or maybe there's a module already on CPAN for it.

The way forward always starts with a minimal test.
  • Comment on Re: getting is_deeply test::more to print to log ( Test::More->builder->failure_output )
  • Select or Download Code