"Fossies" - the Fresh Open Source Software Archive 
Member "perl-5.32.1/cpan/HTTP-Tiny/t/010_url.t" (18 Dec 2020, 1695 Bytes) of package /linux/misc/perl-5.32.1.tar.xz:
As a special service "Fossies" has tried to format the requested text file into HTML format (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 #!perl
2
3 use strict;
4 use warnings;
5
6 use Test::More 0.86;
7 use HTTP::Tiny;
8
9 my @tests = (
10 [ 'HtTp://Example.COM/', 'http', 'example.com', 80, '/', '', ],
11 [ 'HtTp://Example.com:1024/', 'http', 'example.com', 1024, '/', '', ],
12 [ 'http://example.com', 'http', 'example.com', 80, '/', '', ],
13 [ 'http://example.com:', 'http', 'example.com', 80, '/', '', ],
14 [ 'http://foo@example.com:', 'http', 'example.com', 80, '/', 'foo', ],
15 [ 'http://foo:pass@example.com:', 'http', 'example.com', 80, '/', 'foo:pass', ],
16 [ 'http://@example.com:', 'http', 'example.com', 80, '/', '', ],
17 [ 'http://example.com?foo=bar', 'http', 'example.com', 80, '/?foo=bar', '', ],
18 [ 'http://example.com?foo=bar#fragment', 'http', 'example.com', 80, '/?foo=bar', '', ],
19 [ 'http://example.com/path?foo=bar', 'http', 'example.com', 80, '/path?foo=bar', '', ],
20 [ 'http:///path?foo=bar', 'http', 'localhost', 80, '/path?foo=bar', '', ],
21 [ 'HTTPS://example.com/', 'https', 'example.com', 443, '/', '', ],
22 [ 'http://[::]:1024', 'http', '[::]', 1024, '/', '', ],
23 [ 'xxx://foo/', 'xxx', 'foo', undef, '/', '', ],
24 );
25
26 plan tests => scalar @tests;
27
28 for my $test (@tests) {
29 my $url = shift(@$test);
30 my $got = [ HTTP::Tiny->_split_url($url) ];
31 my $exp = $test;
32 is_deeply($got, $exp, "->split_url('$url')") or diag explain $got;
33 }
34
35