aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/uri_string_SUITE.erl
diff options
context:
space:
mode:
authorPéter Dimitrov <[email protected]>2017-10-27 16:54:27 +0200
committerPéter Dimitrov <[email protected]>2017-10-27 17:16:27 +0200
commitce78af7e5a76dc4a27673ab5c80a315762b992b1 (patch)
tree367eac7591b67e6856d4cba3eea7b18949ce62a5 /lib/stdlib/test/uri_string_SUITE.erl
parent3d12c8f164f79dd67967ba5c7df7d3c555dc0f29 (diff)
downloadotp-ce78af7e5a76dc4a27673ab5c80a315762b992b1.tar.gz
otp-ce78af7e5a76dc4a27673ab5c80a315762b992b1.tar.bz2
otp-ce78af7e5a76dc4a27673ab5c80a315762b992b1.zip
stdlib: Implement normalize/1
Implements the following Syntax-Based Normalizations: - Case Normalization - Percent-Encoding Normalization - Path Segment Normalization - Scheme-Based Normalization - HTTP(S) - Basic support for FTP, SSH, SFTP, TFTP
Diffstat (limited to 'lib/stdlib/test/uri_string_SUITE.erl')
-rw-r--r--lib/stdlib/test/uri_string_SUITE.erl22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/stdlib/test/uri_string_SUITE.erl b/lib/stdlib/test/uri_string_SUITE.erl
index 9ee321c509..1567b9333a 100644
--- a/lib/stdlib/test/uri_string_SUITE.erl
+++ b/lib/stdlib/test/uri_string_SUITE.erl
@@ -22,6 +22,7 @@
-include_lib("common_test/include/ct.hrl").
-export([all/0, suite/0,groups/0,
+ normalize/1,
parse_binary_fragment/1, parse_binary_host/1, parse_binary_host_ipv4/1,
parse_binary_host_ipv6/1,
parse_binary_path/1, parse_binary_pct_encoded_fragment/1, parse_binary_pct_encoded_query/1,
@@ -65,6 +66,7 @@ suite() ->
all() ->
[
+ normalize,
parse_binary_scheme,
parse_binary_userinfo,
parse_binary_pct_encoded_userinfo,
@@ -867,3 +869,23 @@ dissect_query_negative(_Config) ->
{error,invalid_character,"ö"} = uri_string:dissect_query(<<"föo+bar=1&amp;%C3%B6=2">>),
{error,invalid_input,<<"ö">>} =
uri_string:dissect_query([<<"foo+bar=1&amp;">>,<<"%C3%B6=2ö">>]).
+
+normalize(_Config) ->
+ "/a/g" = uri_string:normalize("/a/b/c/./../../g"),
+ <<"mid/6">> = uri_string:normalize(<<"mid/content=5/../6">>),
+ "http://localhost-%C3%B6rebro/a/g" =
+ uri_string:normalize("http://localhos%74-%c3%b6rebro:80/a/b/c/./../../g"),
+ <<"http://localhost-%C3%B6rebro/a/g">> =
+ uri_string:normalize(<<"http://localhos%74-%c3%b6rebro:80/a/b/c/./../../g">>),
+ <<"https://localhost/">> =
+ uri_string:normalize(<<"https://localhost:443">>),
+ <<"https://localhost:445/">> =
+ uri_string:normalize(<<"https://localhost:445">>),
+ <<"ftp://localhost">> =
+ uri_string:normalize(<<"ftp://localhost:21">>),
+ <<"ssh://localhost">> =
+ uri_string:normalize(<<"ssh://localhost:22">>),
+ <<"sftp://localhost">> =
+ uri_string:normalize(<<"sftp://localhost:22">>),
+ <<"tftp://localhost">> =
+ uri_string:normalize(<<"tftp://localhost:69">>).