diff options
Diffstat (limited to 'test/examples_SUITE.erl')
-rw-r--r-- | test/examples_SUITE.erl | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/test/examples_SUITE.erl b/test/examples_SUITE.erl index b9cc7ba..56f612f 100644 --- a/test/examples_SUITE.erl +++ b/test/examples_SUITE.erl @@ -167,6 +167,7 @@ echo_get(Config) -> do_echo_get(Transport, Protocol, Config) -> {200, _, <<"this is fun">>} = do_get(Transport, Protocol, "/?echo=this+is+fun", Config), + {400, _, _} = do_get(Transport, Protocol, "/", Config), ok. %% Echo POST. @@ -393,12 +394,27 @@ websocket(_) -> Msg1 -> exit({connection_failed, Msg1}) end, + %% Check that we receive the message sent on timer on init. + receive + {gun_ws, Pid, {text, <<"Hello!">>}} -> + ok + after 2000 -> + exit(timeout) + end, + %% Check that we receive subsequent messages sent on timer. + receive + {gun_ws, Pid, {text, <<"How' you doin'?">>}} -> + ok + after 2000 -> + exit(timeout) + end, + %% Check that we receive the echoed message. gun:ws_send(Pid, {text, <<"hello">>}), receive {gun_ws, Pid, {text, <<"That's what she said! hello">>}} -> - ok; - Msg2 -> - exit({receive_failed, Msg2}) + ok + after 500 -> + exit(timeout) end, gun:ws_send(Pid, close) after |