Test::...Router(3pm)
π Test::...Router β the manual, but make it cute β¨
okay bestie so this is Test::Path::Router (perl v5.34.0, dated 2022-06-16, in case the vibe check requires receipts), and it's a whole module for making sure your routes are valid. yes. routes. we're doing this. π
πΈ NAME πΈ
Test::Path::Router β a testing module for testing routes. that's literally it. that's the whole job. she tests routes. π
β¨ VERSION β¨
version 0.15 π¦
π« SYNOPSIS π«
okay so here's the whole vibe, no cap:
use Test::More plan => 1;
use Test::Path::Router;
my $router = Path::Router->new;
# ... define some routes
path_ok($router, 'admin/remove_user/56', '... this is a valid path');
path_is($router,
'admin/edit_user/5',
{
controller => 'admin',
action => 'edit_user',
id => 5,
},
'... the path and mapping match');
mapping_ok($router, {
controller => 'admin',
action => 'edit_user',
id => 5,
}, '... this maps to a valid path');
mapping_is($router,
{
controller => 'admin',
action => 'edit_user',
id => 5,
},
'admin/edit_user/5',
'... the mapping and path match');
routes_ok($router, {
'admin' => {
controller => 'admin',
action => 'index',
},
'admin/add_user' => {
controller => 'admin',
action => 'add_user',
},
'admin/edit_user/5' => {
controller => 'admin',
action => 'edit_user',
id => 5,
}
},
"... our routes are valid");
like look at her go. iconic behavior. π«Ά
π DESCRIPTION π
so this module's entire main character energy is helping you test out your path routes, to make sure they are valid. that's it, that's the plot. she's here to vibe check your routes so you don't ship something broken and have to cry about it later. π
π EXPORTED FUNCTIONS π
here come the girls, in order, as promised:
path_ok ($router, $path, ?$message)path_not_ok ($router, $path, ?$message)path_is ($router, $path, $mapping, ?$message)mapping_ok ($router, $mapping, ?$message)mapping_not_ok ($router, $mapping, ?$message)mapping_is ($router, $mapping, $path, ?$message)routes_ok ($router, \%test_routes, ?$message)
π¦ and let's talk about routes_ok specifically π¦
this test function will accept a set of %test_routes which will get checked against your $router instance. she's thorough. she will check to be sure that all paths in %test_routes procude the expected mappings β yes, "procude", that's what the original says, we're keeping it, character for character, we don't edit β and that all mappings also produce the expected paths. it basically assures you that your paths are roundtrippable, so that you can be confident in them. roundtrippable!! say it with me!! the paths go out and they come BACK. π₯
π BUGS π
all complex software has bugs lurking in it, and this module is no exception. ngl that's just the truth of the universe, bestie. if you find a bug please either email me, or add the bug to cpan-RT. either way, we'll be obsessed with you for reporting it. π
π AUTHOR π
Stevan Little <stevan@cpan.org> β king behavior, fr fr. π
π COPYRIGHT AND LICENSE π
Copyright 2008-2011 Infinity Interactive, Inc.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
π AUTHOR (yes, again, and we love that for her) π
Stevan Little <stevan@cpan.org> β appearing twice in the credits because she simply has that much main character energy. π
π COPYRIGHT AND LICENSE (round two, and honestly? slay) π
This software is copyright (c) 2016 by Infinity Interactive.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
heads up bestie: the AUTHOR and COPYRIGHT AND LICENSE sections really do show up twice in the original, with different years and different license wording. that's not me being messy, that's canon. we reproduce, we don't rewrite history. π«Ά
perl v5.34.0 πΈ 2022-06-16 πΈ Test::...Router(3pm)
and that's the whole page, bestie. go test those routes. periodt. πβ¨π
π¦ where this page comes from
- debian bookworm: libpath-router-perl 0.15-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libpath-router-perl 0.15-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms