Blame t/010_url.t

Packit 3f4df8
#!perl
Packit 3f4df8
Packit 3f4df8
use strict;
Packit 3f4df8
use warnings;
Packit 3f4df8
Packit 3f4df8
use Test::More 0.86;
Packit 3f4df8
use HTTP::Tiny;
Packit 3f4df8
Packit 3f4df8
my @tests = (
Packit 3f4df8
    [ 'HtTp://Example.COM/',                 'http',  'example.com',    80, '/', '',          ],
Packit 3f4df8
    [ 'HtTp://Example.com:1024/',            'http',  'example.com',  1024, '/', '',          ],
Packit 3f4df8
    [ 'http://example.com',                  'http',  'example.com',    80, '/', '',          ],
Packit 3f4df8
    [ 'http://example.com:',                 'http',  'example.com',    80, '/', '',          ],
Packit 3f4df8
    [ 'http://foo@example.com:',             'http',  'example.com',    80, '/', 'foo',          ],
Packit 3f4df8
    [ 'http://foo:pass@example.com:',        'http',  'example.com',    80, '/', 'foo:pass',          ],
Packit 3f4df8
    [ 'http://@example.com:',                'http',  'example.com',    80, '/', '',          ],
Packit 3f4df8
    [ 'http://example.com?foo=bar',          'http',  'example.com',    80, '/?foo=bar', '',  ],
Packit 3f4df8
    [ 'http://example.com?foo=bar#fragment', 'http',  'example.com',    80, '/?foo=bar', '',  ],
Packit 3f4df8
    [ 'http://example.com/path?foo=bar',     'http',  'example.com',    80, '/path?foo=bar', '',  ],
Packit 3f4df8
    [ 'http:///path?foo=bar',                'http',  'localhost',      80, '/path?foo=bar', '',  ],
Packit 3f4df8
    [ 'HTTPS://example.com/',                'https', 'example.com',   443, '/', '',          ],
Packit 3f4df8
    [ 'http://[::]:1024',                    'http',  '[::]',         1024, '/', '',          ],
Packit 3f4df8
    [ 'xxx://foo/',                          'xxx',   'foo',         undef, '/', '',          ],
Packit 3f4df8
);
Packit 3f4df8
Packit 3f4df8
plan tests => scalar @tests;
Packit 3f4df8
Packit 3f4df8
for my $test (@tests) {
Packit 3f4df8
    my $url = shift(@$test);
Packit 3f4df8
    my $got = [ HTTP::Tiny->_split_url($url) ];
Packit 3f4df8
    my $exp = $test;
Packit 3f4df8
    is_deeply($got, $exp, "->split_url('$url')") or diag explain $got;
Packit 3f4df8
}
Packit 3f4df8
Packit 3f4df8