diff options
author | Loïc Hoguin <[email protected]> | 2012-09-24 02:58:33 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2012-09-24 04:53:12 +0200 |
commit | 3c10d5488396aaeeae7666aa25361c227db039f2 (patch) | |
tree | 00901e1cb1b4a716bd5811f0b4bc0f4370533a50 /test | |
parent | 793d058125da4fc81d85c031bf79cc39f65c823a (diff) | |
download | cowboy-3c10d5488396aaeeae7666aa25361c227db039f2.tar.gz cowboy-3c10d5488396aaeeae7666aa25361c227db039f2.tar.bz2 cowboy-3c10d5488396aaeeae7666aa25361c227db039f2.zip |
Removal of binary:split from cowboy_dispatcher and small optimizations
The internal host_tokens value now has host tokens in reverse order
compared to before. This allows us to remove one lists:reverse call.
Diffstat (limited to 'test')
-rw-r--r-- | test/dispatcher_prop.erl | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/dispatcher_prop.erl b/test/dispatcher_prop.erl index 163fcd8..26c4f87 100644 --- a/test/dispatcher_prop.erl +++ b/test/dispatcher_prop.erl @@ -49,12 +49,14 @@ prop_split_host_symmetric() -> ?FORALL(Server, server(), begin case cowboy_dispatcher:split_host(Server) of {Tokens, RawHost, undefined} -> - (Server == RawHost) and (Server == binary_join(Tokens, ".")); + (Server == RawHost) + and (Server == binary_join(lists:reverse(Tokens), ".")); {Tokens, RawHost, Port} -> PortBin = (list_to_binary(":" ++ integer_to_list(Port))), (Server == << RawHost/binary, PortBin/binary >>) - and (Server == << (binary_join(Tokens, "."))/binary, - PortBin/binary >>) + and (Server == + << (binary_join(lists:reverse(Tokens), "."))/binary, + PortBin/binary >>) end end). %% Internal. |