Test::S...:ToTest2(3)

πŸ“¦
version 1.302027 Β· 2 versions
, in fedora 43

✨ Test::S...:ToTest2 ✨

okay bestie, so this is a page from the User Contributed Perl Documentation (yes it's giving ✨community✨), and it's literally your glow-up guide πŸ’…


🌸 NAME 🌸

Test::Stream::Manual::ToTest2 β€” how to move your code over to Test2 / Test2-Suite 🚚✨


πŸ’– DESCRIPTION πŸ’–

so here's the tea, bestie: Test::Stream is deprecated 😭 in favor of Test2, Test2::Suite, and Test2::Workflow. it's not you, it's the ecosystem. it's giving "we're evolving" πŸ¦‹


πŸ—ΊοΈ MAP πŸ—ΊοΈ

this section is your lil treasure map 🧭 β€” it briefly tells you where to look for replacements. no cap, just point you at the new spots.

πŸ«€ THE GUTS AND INTERNALS πŸ«€

CONTEXT

if you used the context() method, it now lives in Test2::API and the usage is identical πŸ‘― Converting from Test-Stream's context() function could be as easy as changing:

use Test::Stream::Context qw/context/

to

use Test2::API qw/context/

One major gotcha though 😬: the debug() attribute is gone. instead there's a trace() attribute, but heads up β€” its usage is not identical. don't assume, fr fr.

TODO/SKIP

TODO and SKIP are no longer managed inside the Context and DebugInfo objects. Skip is now a full fledged event type β€” Test2::Event::Skip β€” and Test2::API::Context has added a skip() method. slay πŸ’…

TODO is no longer tracked at all by the Test2 internals. instead, look at Test2::Tools::Todo and/or Test2::Todo, which are both part of Test2::Suite. these tools manage TODO as a hub filter ✨

IPC

IPC has not changed much 🧘 load the Test2::IPC module to make sure IPC is loaded if you need it.

CAPABILITIES

Test::Stream::Capabilities has been merged with Test::Stream::Util in Test2::Util. two for one, iconic πŸ‘‘

EXPORTER

Test::Stream::Exporter is completely gone πŸ’€ use Exporter, Export::Declare, Exporter::Declare, or Sub::Exporter.

HASHBASE

see Test2::Util::HashBase.

Change:

use Test::Stream::HashBase(
    base => 'Parent::Class',
    accessors => [qw/foo bar baz/],
);

To:

use parent 'Parent::Class';
use Test2::Util::HashBase qw/foo bar baz/;

EVENTS

see Test2::Event for the new event base class. Very little has changed apart from the HashBase usage πŸŽ€

SYNC

Test::Stream::Sync has been replaced by Test2::API. One major difference: Test2::API exports functions, you do not call class methods on it the way you did with Test2::Sync. Test2::API also adds and renames several functions πŸ‘€

HUB AND STATE

Test::Stream::Hub and Test::Stream::State have been merged into Test2::API::Stack. Methods from both are now in a single class. Some deprecated methods were removed βœ‚οΈ

🧰 TOOLS, PLUGINS, FORMATTERS, ETC. 🧰

there is a new namespace layout, bestie. Test::Stream::Plugin:: has been split into:

  • Test2::Tools:: β€” Tools live here. πŸ”§
  • Test2::Bundle:: β€” Bundles live here. 🎁
  • Test2::Plugin:: β€” Plugins (behavior modifications) live here. πŸͺ„
  • Test2::Require:: β€” Things that cause a test to skip all live here. πŸ™ˆ
  • Test2::Formatter:: β€” Formatters live here. πŸ’…

-V1

Test::Stream::Bundle::V1 is now spelled Test2::Bundle::Extended.

-Classic

Test::Stream::Bundle::Classic is now spelled Test2::Bundle::Classic. (yes the name stayed the same, we love consistency 🫢)

πŸ“‹ SPEC AND WORKFLOWS πŸ“‹

All the spec and workflow stuff has moved to Test2::Workflow. This was never made stable so I don't expect anyone to need a conversion guide. honestly? it's giving "we don't talk about that era" πŸ’€

πŸ§ͺ TESTING YOUR TESTS πŸ§ͺ

Test2::API now exports the $events = intercept { ... } function. ✨ obsessed.


πŸ”— SOURCE πŸ”—

The source code repository for Test::Stream can be found at http://github.com/Test-More/Test-Stream/. go star it, it's free πŸ‘‘


🫢 MAINTAINERS 🫢

Chad Granum <exodist@cpan.org>


πŸ‘‘ AUTHORS πŸ‘‘

Chad Granum <exodist@cpan.org>


Copyright 2015 Chad Granum <exodist7@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://dev.perl.org/licenses/


and that's the whole page, bestie πŸŽ€ perl v5.42.0, dated 2025-07-25 β€” that's when this lil Test::S...:ToTest2(3) page was born. k bye, go migrate your tests, you got this πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from