diff options
author | Ingela Anderton Andin <[email protected]> | 2015-10-27 09:46:09 +0100 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2015-10-27 09:46:09 +0100 |
commit | 7908256c72e4a110154c2db61220973fff511614 (patch) | |
tree | 4a907c3580e1b037cfc80f0ed87472366ddbf729 /lib/kernel/test/gen_tcp_api_SUITE.erl | |
parent | a76cc1d337c0bf44ecefebeccac2d08e496ba7e8 (diff) | |
parent | 61d214cff5fe50b2806f8f977d36bccd412bcfc4 (diff) | |
download | otp-7908256c72e4a110154c2db61220973fff511614.tar.gz otp-7908256c72e4a110154c2db61220973fff511614.tar.bz2 otp-7908256c72e4a110154c2db61220973fff511614.zip |
Merge branch 'preloaded/ia/pr/758/OTP-12837' into maint
* preloaded/ia/pr/758/OTP-12837:
erts: Include test in group so that it is run
erts: Clarify documentation
erts: Add {line_delimiter, byte()} option to inet:setopts/2
Diffstat (limited to 'lib/kernel/test/gen_tcp_api_SUITE.erl')
-rw-r--r-- | lib/kernel/test/gen_tcp_api_SUITE.erl | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/kernel/test/gen_tcp_api_SUITE.erl b/lib/kernel/test/gen_tcp_api_SUITE.erl index a051d504b2..962471c20c 100644 --- a/lib/kernel/test/gen_tcp_api_SUITE.erl +++ b/lib/kernel/test/gen_tcp_api_SUITE.erl @@ -31,7 +31,7 @@ init_per_testcase/2, end_per_testcase/2, t_connect_timeout/1, t_accept_timeout/1, t_connect_bad/1, - t_recv_timeout/1, t_recv_eof/1, + t_recv_timeout/1, t_recv_eof/1, t_recv_delim/1, t_shutdown_write/1, t_shutdown_both/1, t_shutdown_error/1, t_shutdown_async/1, t_fdopen/1, t_fdconnect/1, t_implicit_inet6/1]). @@ -48,7 +48,7 @@ all() -> groups() -> [{t_accept, [], [t_accept_timeout]}, {t_connect, [], [t_connect_timeout, t_connect_bad]}, - {t_recv, [], [t_recv_timeout, t_recv_eof]}]. + {t_recv, [], [t_recv_timeout, t_recv_eof, t_recv_delim]}]. @@ -131,6 +131,21 @@ t_recv_eof(Config) when is_list(Config) -> ?line {error, closed} = gen_tcp:recv(Client, 0), ok. +t_recv_delim(doc) -> "Test using message delimiter $X"; +t_recv_delim(suite) -> []; +t_recv_delim(Config) when is_list(Config) -> + {ok, L} = gen_tcp:listen(0, []), + {ok, Port} = inet:port(L), + Opts = [{active,false},{packet,line},{line_delimiter,$X}], + {ok, Client} = gen_tcp:connect(localhost, Port, Opts), + {ok, A} = gen_tcp:accept(L), + ok = gen_tcp:send(A, "abcXefgX"), + {ok, "abcX"} = gen_tcp:recv(Client, 0, 0), + {ok, "efgX"} = gen_tcp:recv(Client, 0, 0), + ok = gen_tcp:close(Client), + ok = gen_tcp:close(A), + ok. + %%% gen_tcp:shutdown/2 t_shutdown_write(Config) when is_list(Config) -> |