aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2010-07-02 14:37:12 +0200
committerRaimo Niskanen <[email protected]>2010-07-02 14:37:12 +0200
commita7d8a32845852d5ca3df6453ed07fe79d01e8653 (patch)
tree3cf3f9be373e9c03dbc3b061a0d406b17a7fed81
parentc78bc8bfc4cc1246fa77f3ce32d534982a7eb2b4 (diff)
downloadotp-a7d8a32845852d5ca3df6453ed07fe79d01e8653.tar.gz
otp-a7d8a32845852d5ca3df6453ed07fe79d01e8653.tar.bz2
otp-a7d8a32845852d5ca3df6453ed07fe79d01e8653.zip
Add test for gen_udp:connect
-rw-r--r--lib/kernel/test/gen_udp_SUITE.erl21
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/kernel/test/gen_udp_SUITE.erl b/lib/kernel/test/gen_udp_SUITE.erl
index bd5685952e..fa1991872b 100644
--- a/lib/kernel/test/gen_udp_SUITE.erl
+++ b/lib/kernel/test/gen_udp_SUITE.erl
@@ -34,12 +34,12 @@
-export([send_to_closed/1,
buffer_size/1, binary_passive_recv/1, bad_address/1,
- read_packets/1, open_fd/1]).
+ read_packets/1, open_fd/1, connect/1]).
all(suite) ->
[send_to_closed,
buffer_size, binary_passive_recv, bad_address, read_packets,
- open_fd].
+ open_fd, connect].
init_per_testcase(_Case, Config) ->
?line Dog=test_server:timetrap(?default_timeout),
@@ -408,3 +408,20 @@ start_node(Name) ->
stop_node(Node) ->
?t:stop_node(Node).
+
+
+connect(suite) ->
+ [];
+connect(doc) ->
+ ["Test that connect/3 has effect"];
+connect(Config) when is_list(Config) ->
+ Addr = {127,0,0,1},
+ {ok,S1} = gen_udp:open(0),
+ {ok,P1} = inet:port(S1),
+ {ok,S2} = gen_udp:open(0),
+ ok = inet:setopts(S2, [{active,false}]),
+ ok = gen_udp:close(S1),
+ ok = gen_udp:connect(S2, Addr, P1),
+ ok = gen_udp:send(S2, <<16#deadbeef:32>>),
+ {error,econnrefused} = gen_udp:recv(S2, 0, 5),
+ ok.