aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/uri_string_SUITE.erl
diff options
context:
space:
mode:
authorPéter Dimitrov <[email protected]>2017-09-29 16:54:50 +0200
committerPéter Dimitrov <[email protected]>2017-10-23 15:53:28 +0200
commit505579acda74b9281c965488f86cbd6c83254a57 (patch)
tree281f4adfc53cc0d99e590cd5a0e4186f2e286846 /lib/stdlib/test/uri_string_SUITE.erl
parent892bf58ee115a7e56ff38083afd85702bb8e14d3 (diff)
downloadotp-505579acda74b9281c965488f86cbd6c83254a57.tar.gz
otp-505579acda74b9281c965488f86cbd6c83254a57.tar.bz2
otp-505579acda74b9281c965488f86cbd6c83254a57.zip
stdlib: Improve calculation of parsed binary
- Improved calculation of parsed binary. - Added tests for special corner cases. - Fixed dialyzer warnings.
Diffstat (limited to 'lib/stdlib/test/uri_string_SUITE.erl')
-rw-r--r--lib/stdlib/test/uri_string_SUITE.erl19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/stdlib/test/uri_string_SUITE.erl b/lib/stdlib/test/uri_string_SUITE.erl
index 1859a25a18..0eb5105c35 100644
--- a/lib/stdlib/test/uri_string_SUITE.erl
+++ b/lib/stdlib/test/uri_string_SUITE.erl
@@ -31,7 +31,7 @@
parse_path/1, parse_pct_encoded_fragment/1, parse_pct_encoded_query/1,
parse_pct_encoded_userinfo/1, parse_port/1,
parse_query/1, parse_scheme/1, parse_userinfo/1,
- parse_list/1, parse_binary/1, parse_mixed/1, parse_relative/1,
+ parse_list/1, parse_binary/1, parse_mixed/1, parse_relative/1, parse_special/1,
recompose_fragment/1, recompose_parse_fragment/1,
recompose_query/1, recompose_parse_query/1,
recompose_path/1, recompose_parse_path/1,
@@ -89,6 +89,7 @@ all() ->
parse_binary,
parse_mixed,
parse_relative,
+ parse_special,
recompose_fragment,
recompose_parse_fragment,
recompose_query,
@@ -651,6 +652,22 @@ parse_relative(_Config) ->
#{path := "foo"} =
uri_string:parse(lists:append("fo",<<"o">>)).
+parse_special(_Config) ->
+ #{host := [],query := "?"} = uri_string:parse("//?"),
+ #{fragment := [],host := []} = uri_string:parse("//#"),
+ #{host := [],query := "?",scheme := "foo"} = uri_string:parse("foo://?"),
+ #{fragment := [],host := [],scheme := "foo"} = uri_string:parse("foo://#"),
+ #{host := <<>>, path := <<"/">>} = uri_string:parse(<<"///">>),
+ #{host := <<"hostname">>} = uri_string:parse(<<"//hostname">>),
+ #{host := <<>>, path := <<"/hostname">>} = uri_string:parse(<<"///hostname">>),
+ #{host := [],path := "/",query := "?"} = uri_string:parse("///?"),
+ #{fragment := [],host := [],path := "/"} = uri_string:parse("///#"),
+ #{host := "foo",query := "?"} = uri_string:parse("//foo?"),
+ #{fragment := [],host := "foo"} = uri_string:parse("//foo#"),
+ #{host := "foo",path := "/"} = uri_string:parse("//foo/"),
+ #{host := "foo",query := "?",scheme := "http"} = uri_string:parse("http://foo?"),
+ #{fragment := [],host := "foo",scheme := "http"} = uri_string:parse("http://foo#"),
+ #{host := "foo",path := "/",scheme := "http"} = uri_string:parse("http://foo/").
%%-------------------------------------------------------------------------
%% Recompose tests