Subject: | Path component values getting erroneously dropped |
The mapping for a placeholder path component gets discarded if the component's value
evaluates to false, as in the example cases given in the test file. I tried to sort it out but got
lost amid the source generation.
Subject: | router-fail.pl |
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Path::Router;
my $router = Path::Router->new;
$router->add_route( '/asdf/:foo/:bar' );
my @paths = (
['/asdf/123/456', '123', '456'],
['/asdf/0/456', '0', '456'],
['/asdf/123/0', '123', '0'],
);
for (@paths) {
my $match = $router->match($_->[0]);
is $match->mapping->{foo}, $_->[1];
is $match->mapping->{bar}, $_->[2];
}
done_testing;