in reply to Re^4: STDERR in Test Results
in thread STDERR in Test Results
Could it be because I am generating the warnings by printing directly to STDERR
Yes:
use strict; use warnings; use Test::More tests => 2; use Test::Warn; # Your code which gives an expected warning sub foo { warn "Stripe Webhook Error: Invalid Stripe Signature\n"; } sub bar { STDERR->print ("Stripe Webhook Error: Invalid Stripe Signature\n") +; } # Test your code warning_is { foo (); } "Stripe Webhook Error: Invalid Stripe Signature +\n", 'Invalid sig warning issued'; warning_is { bar (); } "Stripe Webhook Error: Invalid Stripe Signature +\n", 'Invalid sig STDERR print issued';
So don't do that. :-)
🦛
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: STDERR in Test Results
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 | |
|
Re^6: STDERR in Test Results
by Bod (Parson) on Jun 19, 2023 at 15:55 UTC |