Mailing List Archive

Perl now includes Test2::Suite
As of yesterday, bleadperl now ships with the full Test2::Suite
distribution, which includes `Test2::V0`.

This was merged a little bit after the 5.39.3 release so it'll make its
first public outing in 5.39.4. The perldelta says

• Test2::Suite 0.000156 has been added to the Perl core.

This distribution contains a comprehensive set of test tools
for writing unit tests. It is the successor to Test::More and
similar modules. Its inclusion in the Perl core means that
CPAN module tests can be written using this suite of tools
without extra dependencies.

• Term::Table 0.017 has been added to the Perl core.

This module is a dependency of Test2::Suite.

Over the past few months I've already been migrating quite a lot of my
CPAN dists into using Test2, and I imagine I'll continue to do so.

Test2 has a "migration guide" manual that you might find useful:

https://metacpan.org/pod/Test2::Manual::Testing::Migrating

Though honestly I find I get my tests about 99% correct already by
simply doing:

$ find -name \*.t | xargs sed -i 's/use Test::More/use Test2::V0/'
$ find -name \*.t | xargs sed -i 's/is_deeply(/is(/'

then manually editing any other edge-cases that I find; but that's
perhaps easier because my existing test style already mostly matched
what Test2 wanted.

Anyhow, I suggest going to check it out, because it's verymuch the
direction that further development will be happening. The legacy tools
of `Test::More` and friends are unfortunately now not suitable for
adding any new features or tools to, so I consider them "end-of-life".
They'll continue to work, but I wouldn't suggest anyone write any new
tests based on them, and instead consider gradually migrating what you
have into Test2 instead.

--
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/
Re: Perl now includes Test2::Suite [ In reply to ]
Oh my goodness, this is one of the most exciting things I've seen all year.

On Thu, Sep 21, 2023 at 1:22?PM Paul "LeoNerd" Evans <leonerd@leonerd.org.uk>
wrote:

> As of yesterday, bleadperl now ships with the full Test2::Suite
> distribution, which includes `Test2::V0`.
>
> This was merged a little bit after the 5.39.3 release so it'll make its
> first public outing in 5.39.4. The perldelta says
>
> • Test2::Suite 0.000156 has been added to the Perl core.
>
> This distribution contains a comprehensive set of test tools
> for writing unit tests. It is the successor to Test::More and
> similar modules. Its inclusion in the Perl core means that
> CPAN module tests can be written using this suite of tools
> without extra dependencies.
>
> • Term::Table 0.017 has been added to the Perl core.
>
> This module is a dependency of Test2::Suite.
>
> Over the past few months I've already been migrating quite a lot of my
> CPAN dists into using Test2, and I imagine I'll continue to do so.
>
> Test2 has a "migration guide" manual that you might find useful:
>
> https://metacpan.org/pod/Test2::Manual::Testing::Migrating
>
> Though honestly I find I get my tests about 99% correct already by
> simply doing:
>
> $ find -name \*.t | xargs sed -i 's/use Test::More/use Test2::V0/'
> $ find -name \*.t | xargs sed -i 's/is_deeply(/is(/'
>
> then manually editing any other edge-cases that I find; but that's
> perhaps easier because my existing test style already mostly matched
> what Test2 wanted.
>
> Anyhow, I suggest going to check it out, because it's verymuch the
> direction that further development will be happening. The legacy tools
> of `Test::More` and friends are unfortunately now not suitable for
> adding any new features or tools to, so I consider them "end-of-life".
> They'll continue to work, but I wouldn't suggest anyone write any new
> tests based on them, and instead consider gradually migrating what you
> have into Test2 instead.
>
> --
> Paul "LeoNerd" Evans
>
> leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
> http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/
>
Re: Perl now includes Test2::Suite [ In reply to ]
It would be useful if there was a generic migration script which takes a repository using Test::More and rewrites it to use Test2 (Test2::V0).



LNATION - email@lnation.org

Where there is no vision, there is no hope.

> On 21 Sep 2023, at 12:24, Veesh Goldman <rabbiveesh@gmail.com> wrote:
>
> Oh my goodness, this is one of the most exciting things I've seen all year.
>
> On Thu, Sep 21, 2023 at 1:22?PM Paul "LeoNerd" Evans <leonerd@leonerd.org.uk <mailto:leonerd@leonerd.org.uk>> wrote:
> As of yesterday, bleadperl now ships with the full Test2::Suite
> distribution, which includes `Test2::V0`.
>
> This was merged a little bit after the 5.39.3 release so it'll make its
> first public outing in 5.39.4. The perldelta says
>
> • Test2::Suite 0.000156 has been added to the Perl core.
>
> This distribution contains a comprehensive set of test tools
> for writing unit tests. It is the successor to Test::More and
> similar modules. Its inclusion in the Perl core means that
> CPAN module tests can be written using this suite of tools
> without extra dependencies.
>
> • Term::Table 0.017 has been added to the Perl core.
>
> This module is a dependency of Test2::Suite.
>
> Over the past few months I've already been migrating quite a lot of my
> CPAN dists into using Test2, and I imagine I'll continue to do so.
>
> Test2 has a "migration guide" manual that you might find useful:
>
> https://metacpan.org/pod/Test2::Manual::Testing::Migrating <https://metacpan.org/pod/Test2::Manual::Testing::Migrating>
>
> Though honestly I find I get my tests about 99% correct already by
> simply doing:
>
> $ find -name \*.t | xargs sed -i 's/use Test::More/use Test2::V0/'
> $ find -name \*.t | xargs sed -i 's/is_deeply(/is(/'
>
> then manually editing any other edge-cases that I find; but that's
> perhaps easier because my existing test style already mostly matched
> what Test2 wanted.
>
> Anyhow, I suggest going to check it out, because it's verymuch the
> direction that further development will be happening. The legacy tools
> of `Test::More` and friends are unfortunately now not suitable for
> adding any new features or tools to, so I consider them "end-of-life".
> They'll continue to work, but I wouldn't suggest anyone write any new
> tests based on them, and instead consider gradually migrating what you
> have into Test2 instead.
>
> --
> Paul "LeoNerd" Evans
>
> leonerd@leonerd.org.uk <mailto:leonerd@leonerd.org.uk> | https://metacpan.org/author/PEVANS <https://metacpan.org/author/PEVANS>
> http://www.leonerd.org.uk/ <http://www.leonerd.org.uk/> | https://www.tindie.com/stores/leonerd/ <https://www.tindie.com/stores/leonerd/>
Re: Perl now includes Test2::Suite [ In reply to ]
On Thu, 21 Sep 2023 12:58:52 +0100
lnation <email@lnation.org> wrote:

> It would be useful if there was a generic migration script which
> takes a repository using Test::More and rewrites it to use Test2
> (Test2::V0).

If you wish to write a program that statically-analyses unit test files
written in perl code and rewrites parts of them for different
behaviour, go ahead. I don't think anyone will try to stop you. :)

--
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/
Re: Perl now includes Test2::Suite [ In reply to ]
On Thu, Sep 21, 2023 at 11:22:36AM +0100, Paul "LeoNerd" Evans wrote:
> As of yesterday, bleadperl now ships with the full Test2::Suite
> distribution, which includes `Test2::V0`.

Wonderful news!

> Though honestly I find I get my tests about 99% correct already by
> simply doing:
>
> $ find -name \*.t | xargs sed -i 's/use Test::More/use Test2::V0/'
> $ find -name \*.t | xargs sed -i 's/is_deeply(/is(/'

I gave this a bash in a codebase I help maintain, and it worked well
enough, save for the fact that we use(d) the "tests => <num_tests>"
syntax, so I had to get rid of that and add "done_testing" to the end of
all the tests. I never enjoyed counting and updating the number of tests
anyway, so I consider this an improvement :-)

--
Ole Peder Brandtzæg | En KLST/ITK-hybrid
Please don't look at me with those eyes
Please don't hint that you're capable of lies
Re: Perl now includes Test2::Suite [ In reply to ]
On Thu, Sep 21, 2023 at 8:15?PM Ole Peder Brandtzæg <olebra@samfundet.no>
wrote:

> On Thu, Sep 21, 2023 at 11:22:36AM +0100, Paul "LeoNerd" Evans wrote:
> > As of yesterday, bleadperl now ships with the full Test2::Suite
> > distribution, which includes `Test2::V0`.
>
> Wonderful news!
>
> > Though honestly I find I get my tests about 99% correct already by
> > simply doing:
> >
> > $ find -name \*.t | xargs sed -i 's/use Test::More/use Test2::V0/'
> > $ find -name \*.t | xargs sed -i 's/is_deeply(/is(/'
>
> I gave this a bash in a codebase I help maintain, and it worked well
> enough, save for the fact that we use(d) the "tests => <num_tests>"
> syntax, so I had to get rid of that and add "done_testing" to the end of
> all the tests. I never enjoyed counting and updating the number of tests
> anyway, so I consider this an improvement :-)
>

FWIW, the replacement of this is a subsequent call to plan($num); but
done_testing is certainly more commonly used as maintenance of the plan
tends to be more trouble than it's worth.

-Dan
Re: Perl now includes Test2::Suite [ In reply to ]
On Thu, Sep 21, 2023 at 08:34:08PM -0400, Dan Book wrote:
> FWIW, the replacement of this is a subsequent call to plan($num); but
> done_testing is certainly more commonly used as maintenance of the plan
> tends to be more trouble than it's worth.

Yup, I did plan() first before remembering how little I enjoy
maintaining the plans. =)

--
Ole Peder Brandtzæg | En KLST/ITK-hybrid
So what's wrong with living in the past?
It just happens to be the place I saw you last.
Re: Perl now includes Test2::Suite [ In reply to ]
On Thu, Sep 21, 2023 at 12:23?PM Paul "LeoNerd" Evans <
leonerd@leonerd.org.uk> wrote:

> As of yesterday, bleadperl now ships with the full Test2::Suite
> distribution, which includes `Test2::V0`.
>
> This was merged a little bit after the 5.39.3 release so it'll make its
> first public outing in 5.39.4. The perldelta says
>
> • Test2::Suite 0.000156 has been added to the Perl core.
>
> This distribution contains a comprehensive set of test tools
> for writing unit tests. It is the successor to Test::More and
> similar modules. Its inclusion in the Perl core means that
> CPAN module tests can be written using this suite of tools
> without extra dependencies.
>
> • Term::Table 0.017 has been added to the Perl core.
>
> This module is a dependency of Test2::Suite.
>
> Over the past few months I've already been migrating quite a lot of my
> CPAN dists into using Test2, and I imagine I'll continue to do so.
>
> Test2 has a "migration guide" manual that you might find useful:
>
> https://metacpan.org/pod/Test2::Manual::Testing::Migrating
>
> Though honestly I find I get my tests about 99% correct already by
> simply doing:
>
> $ find -name \*.t | xargs sed -i 's/use Test::More/use Test2::V0/'
> $ find -name \*.t | xargs sed -i 's/is_deeply(/is(/'
>
> then manually editing any other edge-cases that I find; but that's
> perhaps easier because my existing test style already mostly matched
> what Test2 wanted.
>
> Anyhow, I suggest going to check it out, because it's verymuch the
> direction that further development will be happening. The legacy tools
> of `Test::More` and friends are unfortunately now not suitable for
> adding any new features or tools to, so I consider them "end-of-life".
> They'll continue to work, but I wouldn't suggest anyone write any new
> tests based on them, and instead consider gradually migrating what you
> have into Test2 instead.
>
> --
> Paul "LeoNerd" Evans
>
> leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
> http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/


I didn't see this coming! Great!

Can we please bump its version number to 1.000000 and include that in the
next stable Perl release?
We all have a tendency to never bump our version numbers above 0.x which
makes our code look less stable and great than it is to the outside world!
Re: Perl now includes Test2::Suite [ In reply to ]
On Fri, 22 Sep 2023 17:34:17 +0200
Alexander Hartmaier <alex.hartmaier@gmail.com> wrote:

> Can we please bump its version number to 1.000000 and include that in
> the next stable Perl release?
> We all have a tendency to never bump our version numbers above 0.x
> which makes our code look less stable and great than it is to the
> outside world!

A fun question, though perl core isn't responsible for the version
numbering of CPAN modules it happens to import. That'd be a question to
EXODIST.

--
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/