Subject: | Use of regular expressions in test declarations |
Adrian Howard writes:
Possible suggestion for improvement... it would be cool if you could pass
regular expressions to the various test_* routines so instead of:
my $SIMPLE = Local::Error::Simple->new();
test_out("not ok 1");
test_fail(+3);
test_err("# expecting: Local::Error::Test exception");
test_err("# found: $SIMPLE");
throws_ok { error("simple") } "Local::Error::Test";
test_test("throws_ok: bad sub-class match detected");
you could do
test_out("not ok 1");
test_fail(+3);
test_err("# expecting: Local::Error::Test exception");
test_err(qr/$# found: Local::Error::Test/);
throws_ok { error("simple") } "Local::Error::Test";
test_test("throws_ok: bad sub-class match detected");