App-perlbrew icon indicating copy to clipboard operation
App-perlbrew copied to clipboard

Rewriting existing tests using Test2

Open gugod opened this issue 1 year ago • 4 comments

As an improvement point, we should probably replace current Test::More -based test code with Test2 .

gugod avatar Jun 12 '24 15:06 gugod

Something like this? https://github.com/gugod/App-perlbrew/compare/develop...lukec:App-perlbrew:Test2-start

I could start chipping away at the other tests if it is helpful...

lukec avatar Jun 12 '24 16:06 lukec

Personally I consider 01-option tests written using Test::YAFT

it q (should recognize option -D)
  => got    => $app->{D}
  => expect => [qw(usethreads DEBUGGING)]
  ;

nok q (app shuld not be quiet'
  => got => $app->{quiet}

when using code to build got value, it automatically handles exceptions. This test will fail when got {} code fails

it q (test message)
  => got { do something }
  => expect => $expectation
;

This test will fail when got {} code doesn't fail

it q (test message)
  => got { do something }
  => throws => $expectation
;

happy-barney avatar Jun 12 '24 17:06 happy-barney

I've ported about half. I am getting into trickier ones and progress is slower, but i'll keep at it.

lukec avatar Jun 13 '24 21:06 lukec

Personally I consider 01-option tests written using Test::YAFT

Looks interesting, and thanks for the information. But let's not mix other topics with this one, which is mainly for replacing the old Test::More-based test code. Feel free to follow-up in a separate issues / PR though.

gugod avatar Jun 13 '24 22:06 gugod