From a8335c63df31f21d88e9d7d1f2b64d32a674cd7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 31 Oct 2018 10:50:57 +0100 Subject: Always dialyze tests and fix some cowboy_req specs --- test/handlers/resp_h.erl | 4 ++++ test/handlers/resp_iolist_body_h.erl | 2 ++ test/handlers/stream_handler_h.erl | 1 + test/handlers/switch_protocol_flush_h.erl | 2 ++ test/handlers/ws_terminate_h.erl | 3 ++- 5 files changed, 11 insertions(+), 1 deletion(-) (limited to 'test/handlers') diff --git a/test/handlers/resp_h.erl b/test/handlers/resp_h.erl index 625a2ea..bfcb95c 100644 --- a/test/handlers/resp_h.erl +++ b/test/handlers/resp_h.erl @@ -2,6 +2,10 @@ -module(resp_h). +%% @todo Probably should have a separate handler for errors, +%% so that we can dialyze all the other correct calls. +-dialyzer({nowarn_function, do/3}). + -export([init/2]). init(Req, Opts) -> diff --git a/test/handlers/resp_iolist_body_h.erl b/test/handlers/resp_iolist_body_h.erl index 938f561..d8989b5 100644 --- a/test/handlers/resp_iolist_body_h.erl +++ b/test/handlers/resp_iolist_body_h.erl @@ -2,6 +2,8 @@ -module(resp_iolist_body_h). +-dialyzer(no_improper_lists). + -export([init/2]). init(Req0, State) -> diff --git a/test/handlers/stream_handler_h.erl b/test/handlers/stream_handler_h.erl index 0f245c6..2196be3 100644 --- a/test/handlers/stream_handler_h.erl +++ b/test/handlers/stream_handler_h.erl @@ -107,6 +107,7 @@ early_error(StreamID, Reason, PartialReq, Resp, Opts) -> end. %% @todo It would be good if we could allow this function to return normally. +-spec takeover(_, _, _, _, _, _, _) -> no_return(). takeover(Parent, Ref, Socket, Transport, Opts, Buffer, State=#state{pid=Pid}) -> Pid ! {Pid, self(), takeover, Parent, Ref, Socket, Transport, Opts, Buffer, State}, exit(normal). diff --git a/test/handlers/switch_protocol_flush_h.erl b/test/handlers/switch_protocol_flush_h.erl index 3d525ee..1b06df2 100644 --- a/test/handlers/switch_protocol_flush_h.erl +++ b/test/handlers/switch_protocol_flush_h.erl @@ -27,6 +27,8 @@ info(_, _, State) -> terminate(_, _, _) -> ok. +%% @todo It would be good if we could allow this function to return normally. +-spec takeover(_, _, _, _, _, _, _) -> no_return(). takeover(_, _, _, _, _, _, Pid) -> Msgs = receive_all([]), Pid ! {Pid, Msgs}, diff --git a/test/handlers/ws_terminate_h.erl b/test/handlers/ws_terminate_h.erl index 4621df6..12e6d1a 100644 --- a/test/handlers/ws_terminate_h.erl +++ b/test/handlers/ws_terminate_h.erl @@ -31,4 +31,5 @@ websocket_info(_, State) -> {ok, State}. terminate(Reason, Req, #state{pid=Pid}) -> - Pid ! {terminate, Reason, Req}. + Pid ! {terminate, Reason, Req}, + ok. -- cgit v1.2.3