aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-03-25 11:42:57 +0100
committerLoïc Hoguin <[email protected]>2014-03-25 11:42:57 +0100
commitabf246c9aafe0d2760184e54cb9b7e2e80277c9d (patch)
tree3463c1c026c28fb88c08b0c6d3ef997961445bf9
parent0c0caa3a471591a9f77a9a3198972de0d755766e (diff)
downloadcowboy-abf246c9aafe0d2760184e54cb9b7e2e80277c9d.tar.gz
cowboy-abf246c9aafe0d2760184e54cb9b7e2e80277c9d.tar.bz2
cowboy-abf246c9aafe0d2760184e54cb9b7e2e80277c9d.zip
Make the latin1 cyrillic route tests work on R17+
Instead of relying on the encoding of the file we now simply have list of numbers as they would be inside a latin1 file.
-rw-r--r--src/cowboy_router.erl27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/cowboy_router.erl b/src/cowboy_router.erl
index 3cbf947..ad9d360 100644
--- a/src/cowboy_router.erl
+++ b/src/cowboy_router.erl
@@ -390,14 +390,22 @@ compile_test_() ->
{[<<"path">>, <<"to">>, <<"resource">>], [], hb, ob}]}]},
{[{'_', [{"/path/to/resource/", h, o}]}],
[{'_', [], [{[<<"path">>, <<"to">>, <<"resource">>], [], h, o}]}]},
- {[{'_', [{"/путь/к/ресурсу/", h, o}]}],
- [{'_', [], [{[<<"путь">>, <<"к">>, <<"ресурсу">>], [], h, o}]}]},
+ % Cyrillic from a latin1 encoded file.
+ {[{'_', [{[47,208,191,209,131,209,130,209,140,47,208,186,47,209,128,
+ 208,181,209,129,209,131,209,128,209,129,209,131,47], h, o}]}],
+ [{'_', [], [{[<<208,191,209,131,209,130,209,140>>, <<208,186>>,
+ <<209,128,208,181,209,129,209,131,209,128,209,129,209,131>>],
+ [], h, o}]}]},
{[{"cowboy.example.org.", [{'_', h, o}]}],
[{[<<"org">>, <<"example">>, <<"cowboy">>], [], [{'_', [], h, o}]}]},
{[{".cowboy.example.org", [{'_', h, o}]}],
[{[<<"org">>, <<"example">>, <<"cowboy">>], [], [{'_', [], h, o}]}]},
- {[{"некий.сайт.рф.", [{'_', h, o}]}],
- [{[<<"рф">>, <<"сайт">>, <<"некий">>], [], [{'_', [], h, o}]}]},
+ % Cyrillic from a latin1 encoded file.
+ {[{[208,189,208,181,208,186,208,184,208,185,46,209,129,208,176,
+ 208,185,209,130,46,209,128,209,132,46], [{'_', h, o}]}],
+ [{[<<209,128,209,132>>, <<209,129,208,176,208,185,209,130>>,
+ <<208,189,208,181,208,186,208,184,208,185>>],
+ [], [{'_', [], h, o}]}]},
{[{":subdomain.example.org", [{"/hats/:name/prices", h, o}]}],
[{[<<"org">>, <<"example">>, subdomain], [], [
{[<<"hats">>, name, <<"prices">>], [], h, o}]}]},
@@ -506,8 +514,9 @@ match_info_test_() ->
{[<<"eu">>, <<"ninenines">>, '...'], [], [
{'_', [], match_any, []}
]},
- {[<<"рф">>, <<"сайт">>], [], [
- {[<<"путь">>, '...'], [], match_path, []}
+ % Cyrillic from a latin1 encoded file.
+ {[<<209,128,209,132>>, <<209,129,208,176,208,185,209,130>>], [], [
+ {[<<208,191,209,131,209,130,209,140>>, '...'], [], match_path, []}
]}
],
Tests = [
@@ -523,8 +532,10 @@ match_info_test_() ->
{ok, match_path, [], [], undefined, [<<"path_info">>]}},
{<<"www.ninenines.eu">>, <<"/pathinfo/is/next/foo/bar">>,
{ok, match_path, [], [], undefined, [<<"foo">>, <<"bar">>]}},
- {<<"сайт.рф">>, <<"/путь/домой">>,
- {ok, match_path, [], [], undefined, [<<"домой">>]}}
+ % Cyrillic from a latin1 encoded file.
+ {<<209,129,208,176,208,185,209,130,46,209,128,209,132>>,
+ <<47,208,191,209,131,209,130,209,140,47,208,180,208,190,208,188,208,190,208,185>>,
+ {ok, match_path, [], [], undefined, [<<208,180,208,190,208,188,208,190,208,185>>]}}
],
[{lists:flatten(io_lib:format("~p, ~p", [H, P])), fun() ->
R = match(Dispatch, H, P)