gugod / App-perlbrew

Manage perl installations in your $HOME
https://perlbrew.pl
Other
720 stars 216 forks source link

Replace Testt::Spec with Test2::Tools::Spec #813

Closed gugod closed 2 months ago

gugod commented 3 months ago

Test2::Tools::Spec provides most of the features implemented in Test::Spec and is nearly a drop-in replacement.

Uses of methods from Test::Spec::Mocks needs to be reworked, namely when expects are being used.

lukec commented 3 months ago

This looks cleaner than how I did it in t/installation2.t - nice work!

gugod commented 3 months ago

This looks cleaner than how I did it in t/installation2.t - nice work!

Thanks.

Test2::Tools::Mock ended up being pretty decent by itself, even without the interfaces of Test2::Mock.

Furthermore... after your comment... when I started to rewrite more tests, I found out that due to the extensive use of Test::Spec and actually Test::Spec::Mock, it became rather cumbersome to rewrite t/command-exec.t with just Test2::Tools::Mock and it doesn't look like Test2::Mock would make the rewrite easier... so I latter decided to make a similar version of Test2::Tools::Mock instead, named Mocked, in test2_helper.pl. It's not a drop-in replacement, but something that provides similar API , with somewhat manageable amount of changes on the caller side. That makes it a whole lot easier for the purpose of using Test2-based subroutines.