Input | Expected | Actual | Result |
', htmlentities($input), ' | ';
echo '', htmlentities($output), ' | ';
echo '', htmlentities($aoutput), ' | ';
echo '';
echo $result ? 'Passed' : 'Failed';
echo ' | ';
echo '';
}
$tests = array(
'test.foo' => 'http://test.foo/',
'test.foo.' => 'http://test.foo/',
'http://test.foo:80/' => 'http://test.foo/',
'user@test.foo' => 'http://test.foo/',
'test.foo/path#frag' => 'http://test.foo/path',
'test.foo:81' => 'http://test.foo:81/',
'user:pass@test.foo.:80/?foo#bar' => 'http://test.foo/',
'protocol://foo/' => 'protocol://foo/',
'protocol://foo.:80/' => 'protocol://foo:80/',
'https://test.foo/' => 'https://test.foo/',
'https://:@test.foo.:443?#' => 'https://test.foo/',
'https://test.foo:80' => 'https://test.foo:80/',
'http://host/path/to/file' => 'http://host/path/to/file',
'foo/././bar' => 'http://foo/bar',
'foo/bar/../baz' => 'http://foo/baz',
'foo/bar/./../baz' => 'http://foo/baz',
'http://test.foo/abc/../def/.././' => 'http://test.foo/',
);
array_walk($tests, 'doNormTest');
?>