commit f1ae759f2000978c28efed057ae7697fcaeb92a1
parent 229120ffb20bc9c3199a5abe38c4637bc631120d
Author: Andreas Guldstrand <andreas.guldstrand@gmail.com>
Date: Sat, 20 Feb 2016 02:20:29 +0100
Test::Execute: Add way to test output using a subroutine reference
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/t/Test/Execute.pm b/t/Test/Execute.pm
@@ -78,6 +78,8 @@ sub run {
SKIP: { skip "Expected output undefined", 1 }
} elsif (ref $expected eq 'Regexp') {
like ($output, $expected, "$name - output");
+ } elsif (ref $expected eq 'CODE') {
+ ok ($expected->($output), "$name - output");
} else {
is ($output, $expected, "$name - output");
}