Skip to content

Instantly share code, notes, and snippets.

@chizmw
Created September 17, 2011 20:41
Show Gist options
  • Save chizmw/1224346 to your computer and use it in GitHub Desktop.
Save chizmw/1224346 to your computer and use it in GitHub Desktop.
test_err() experimentation
use Test::More;
use strict;
use warnings;
use Test::Builder::Tester;
test_out("not ok 1 - foo");
test_fail(+1);
fail("foo");
test_test("fail works");
test_out('ok 1 - foo');
pass('foo');
test_test('pass works');
test_out('ok 1 - bar');
test_diag('one man and his dog');
diag 'one man and his dog';
pass('bar');
test_test('test_diag works with string');
test_out('ok 1 - bar');
test_err('# one man and his dog');
diag 'one man and his dog';
pass('bar');
test_test('test_err works with string');
test_out('ok 1 - bar');
test_err(qr/.+/);
diag 'one man and his dog';
pass('bar');
test_test('test_err works with string');
done_testing;
=head1 OUTPUT
[511][chisel@shell:development]➔ prove test_err.t
test_err.t .. 1/?
# Failed test 'test_err works with string'
# at test_err.t line 32.
# STDERR is:
# # one man and his dog
#
# not:
# (?-xism:.+)
# as expected
test_err.t .. Failed 1/5 subtests
Test Summary Report
-------------------
test_err.t (Wstat: 0 Tests: 5 Failed: 1)
Failed test: 5
Files=1, Tests=5, 0 wallclock secs ( 0.03 usr 0.00 sys + 0.02 cusr 0.00 csys = 0.05 CPU)
Result: FAIL
=cut
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment