-
-
Save dboehmer/439d86e1102348c4d081b01b22f96c46 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
my $str = 'foo://xyz?bar=baz+%20'; | |
{ | |
package MyApp; | |
use Mojolicious::Lite; | |
use Test::Most; | |
use URI::Escape; | |
get '/' => sub { | |
my $c = shift; | |
is( $c->url_for( '/?foo=bar&str=' . uri_escape($str) ) => | |
'/?foo=bar&str=foo%3A%2F%2Fxyz%3Fbar%3Dbaz%2B%2520' ); | |
is( $c->url_for( '/#foo=bar&str=' . uri_escape($str) ) => | |
'/#foo=bar&str=foo%3A%2F%2Fxyz%3Fbar%3Dbaz%2B%2520' ); | |
$c->render(""); | |
}; | |
} | |
use Test::Mojo; | |
use Test::Most; | |
my $t = Test::Mojo->new('MyApp'); | |
$t->get_ok('/'); | |
done_testing; | |
__END__ | |
$ prove uri.t -v | |
uri.t .. [Mon Dec 19 18:59:51 2016] [debug] GET "/" | |
[Mon Dec 19 18:59:51 2016] [debug] Routing to a callback | |
ok 1 | |
not ok 2 | |
# Failed test at /home/boehmer/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/Mojolicious/Plugins.pm line 15. | |
# got: '/#foo=bar&str=foo://xyz?bar=baz+%20' | |
# expected: '/#foo=bar&str=foo%3A%2F%2Fxyz%3Fbar%3Dbaz%2B%2520' | |
[Mon Dec 19 18:59:51 2016] [debug] Template ".html.ep" not found | |
[Mon Dec 19 18:59:51 2016] [debug] Template "not_found.development.html.ep" not found | |
[Mon Dec 19 18:59:51 2016] [debug] Template "not_found.html.ep" not found | |
[Mon Dec 19 18:59:51 2016] [debug] Rendering template "mojo/debug.html.ep" | |
[Mon Dec 19 18:59:51 2016] [debug] Rendering template "mojo/menubar.html.ep" | |
[Mon Dec 19 18:59:51 2016] [debug] Your secret passphrase needs to be changed | |
[Mon Dec 19 18:59:51 2016] [debug] 404 Not Found (0.014541s, 68.771/s) | |
ok 3 - GET / | |
1..3 | |
# Looks like you failed 1 test of 3. | |
Dubious, test returned 1 (wstat 256, 0x100) | |
Failed 1/3 subtests | |
Test Summary Report | |
------------------- | |
uri.t (Wstat: 256 Tests: 3 Failed: 1) | |
Failed test: 2 | |
Non-zero exit status: 1 | |
Files=1, Tests=3, 0 wallclock secs ( 0.01 usr 0.00 sys + 0.19 cusr 0.00 csys = 0.20 CPU) | |
Result: FAIL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment