In that case may I suggest starting with Test::Warn? I find it the simplest of the three (and these are not the only three of course) as it has a very logically straightforward approach. Simply:
use strict; use warnings; use Test::More tests => 1; use Test::Warn; # Your code which gives an expected warning sub foo { warn "Stripe Webhook Error: Invalid Stripe Signature\n"; } # Test your code warning_is { foo (); } "Stripe Webhook Error: Invalid Stripe Signature +\n", 'Invalid sig warning issued';
Task::Kensho recommends Test::Warnings which is fine but a little more abstract. Both modules are widely used in other dists. I have found Test::Trap useful on occasion but it can take a bit of wrangling to set up properly.
🦛
In reply to Re^3: STDERR in Test Results
by hippo
in thread STDERR in Test Results
by Bod
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |