diff options
Diffstat (limited to 'test/gun_test.erl')
-rw-r--r-- | test/gun_test.erl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/gun_test.erl b/test/gun_test.erl index 14c70c3..e74fcd0 100644 --- a/test/gun_test.erl +++ b/test/gun_test.erl @@ -106,3 +106,14 @@ receive_from(Pid, Timeout) -> after Timeout -> error(timeout) end. + +receive_all_from(Pid, Timeout) -> + receive_all_from(Pid, Timeout, <<>>). + +receive_all_from(Pid, Timeout, Acc) -> + try + More = receive_from(Pid, Timeout), + receive_all_from(Pid, Timeout, <<Acc/binary, More/binary>>) + catch error:timeout -> + Acc + end. |