#!/usr/bin/perl use strict; use warnings; use Test::More tests => 9; use Test::Differences; my $x = $^O eq 'MSWin32' ? ".exe" : ""; sub cmd_eq_or_diff { my ($command, $expected) = @_; my $output = `$command$x 2>&1`; eq_or_diff($output, $expected, $command); } cmd_eq_or_diff "t/cmpok", < # 666 not ok 2 - the number 23 is definitely 55 # Failed test 'the number 23 is definitely 55' # at t/cmpok.c line 7. # 23 # == # 55 not ok 3 # Failed test at t/cmpok.c line 8. # 23 # == # 55 ok 4 # unrecognized operator 'frob' not ok 5 # Failed test at t/cmpok.c line 10. # 23 # frob # 55 ok 6 not ok 7 # Failed test at t/cmpok.c line 12. # 55 # + # -55 ok 8 not ok 9 # Failed test at t/cmpok.c line 14. # 55 # % # 5 # Looks like you failed 6 tests of 9 run. END cmd_eq_or_diff "t/diesok", <= # 10 # Looks like you failed 2 tests of 5 run. END cmd_eq_or_diff "t/todo", <