aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test
diff options
context:
space:
mode:
authorPéter Dimitrov <[email protected]>2017-10-25 14:43:45 +0200
committerPéter Dimitrov <[email protected]>2017-10-25 14:43:45 +0200
commiteba3d3e5e9b08839dafcb2e8adc6620d9211d96c (patch)
tree3a53d616bc87c0d10f4ed57fbcc3784495922947 /lib/stdlib/test
parent992cda82f16ee23b0114563858d5a082711f659b (diff)
downloadotp-eba3d3e5e9b08839dafcb2e8adc6620d9211d96c.tar.gz
otp-eba3d3e5e9b08839dafcb2e8adc6620d9211d96c.tar.bz2
otp-eba3d3e5e9b08839dafcb2e8adc6620d9211d96c.zip
stdlib: Refactor dissect_query
Diffstat (limited to 'lib/stdlib/test')
-rw-r--r--lib/stdlib/test/uri_string_SUITE.erl18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/stdlib/test/uri_string_SUITE.erl b/lib/stdlib/test/uri_string_SUITE.erl
index c230f7c631..2fc4e1a092 100644
--- a/lib/stdlib/test/uri_string_SUITE.erl
+++ b/lib/stdlib/test/uri_string_SUITE.erl
@@ -846,13 +846,21 @@ dissect_query(_Config) ->
[{"foo","1"}, {"bar", "2"}] = uri_string:dissect_query("foo=1&bar=2"),
[{"foo","1"}, {"bar", "2"}] = uri_string:dissect_query("foo=1;bar=2"),
[{"foo","1"}, {"bar", "222"}] = uri_string:dissect_query([<<"foo=1;bar=2">>,"22"]),
- [{"foo","ö"}, {"bar", "2"}] = uri_string:dissect_query("foo=%C3%B6&amp;bar=2").
+ [{"foo","ö"}, {"bar", "2"}] = uri_string:dissect_query("foo=%C3%B6&amp;bar=2"),
+ [{<<"foo">>,<<"ö"/utf8>>}, {<<"bar">>, <<"2">>}] =
+ uri_string:dissect_query(<<"foo=%C3%B6&amp;bar=2">>),
+ [{"foo bar","1"},{"ö","2"}] =
+ uri_string:dissect_query([<<"foo+bar=1&amp;">>,<<"%C3%B6=2">>]).
dissect_query_negative(_Config) ->
- {error,urldecode,";bar"} =
+ {error,invalid_character,";"} =
uri_string:dissect_query("foo=1&ap;bar=2"),
- {error,urldecode,"&amp;bar"} =
+ {error,invalid_character,"&"} =
uri_string:dissect_query("foo1&amp;bar=2"),
- {error,urldecode,"%XX%B6"} = uri_string:dissect_query("foo=%XX%B6&amp;bar=2"),
+ {error,invalid_percent_encoding,"%XX%B6"} = uri_string:dissect_query("foo=%XX%B6&amp;bar=2"),
{error,invalid_input,<<153,182>>} =
- uri_string:dissect_query("foo=%99%B6&amp;bar=2").
+ uri_string:dissect_query("foo=%99%B6&amp;bar=2"),
+ {error,invalid_character,"ö"} = uri_string:dissect_query("föo+bar=1&amp;%C3%B6=2"),
+ {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ö">>]).