Ovid wrote:

    use Test::Fluent 'no_plan';

    my ( $have, $want ) = ( 1, 1 );
    have $have, want $want, reason 'Some test name';
    have [ 3, 4 ], want [ 4, 5 ], reason 'cuz I said so';   # fails
    true 3,  reason '3 had better be true';
    false 3, reason '3 had better still better be true';    # fails

I would much rather see something like

cmp_ok(
  have       => 1,
  want       => 2,
  reason     => 'Some test name',
  diagnostic => { world => $world },
);

Much more Perlish. I've always disliked some APIs where it's not immediately clear what's a function call and what's an argument to that function: is reason() an argument to want() or have()?. It also seems more obvious for doing things like data-driven tests where you just have a large data structure that tests are run against.

--
Michael Peters
Plus Three, LP

Reply via email to