in reply to Re^2: STDERR in Test Results
in thread STDERR in Test Results
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.
🦛
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: STDERR in Test Results
by Bod (Parson) on Jun 25, 2023 at 09:20 UTC | |
by hippo (Archbishop) on Jun 25, 2023 at 11:17 UTC | |
by Bod (Parson) on Jun 25, 2023 at 16:24 UTC | |
by hippo (Archbishop) on Jun 26, 2023 at 10:05 UTC | |
by afoken (Chancellor) on Jun 25, 2023 at 21:40 UTC | |
by kcott (Archbishop) on Jun 25, 2023 at 10:22 UTC | |
by Bod (Parson) on Jun 25, 2023 at 19:24 UTC | |
|
Re^4: STDERR in Test Results
by Bod (Parson) on Jun 19, 2023 at 15:28 UTC | |
by hippo (Archbishop) on Jun 19, 2023 at 15:43 UTC | |
by Bod (Parson) on Jun 19, 2023 at 16:18 UTC | |
by hippo (Archbishop) on Jun 19, 2023 at 16:30 UTC | |
by soonix (Chancellor) on Jun 19, 2023 at 21:40 UTC | |
by Bod (Parson) on Jun 19, 2023 at 15:55 UTC |