From 4d086abb73f7b9af178c966d5fb66012c4ec6612 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Mon, 13 May 2013 16:12:10 +0200 Subject: [common_test] Add test for ct_telnet using own telnet server The new test suite ct_telnet_SUITE_data/ct_telnet_own_server_SUITE uses the very simple telnet_server.erl located in the common_test test directory. --- .../ct_telnet_own_server_SUITE.erl | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_own_server_SUITE.erl (limited to 'lib/common_test/test/ct_telnet_SUITE_data') diff --git a/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_own_server_SUITE.erl b/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_own_server_SUITE.erl new file mode 100644 index 0000000000..2173c68c11 --- /dev/null +++ b/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_own_server_SUITE.erl @@ -0,0 +1,46 @@ +-module(ct_telnet_own_server_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% TEST SERVER CALLBACK FUNCTIONS +%%-------------------------------------------------------------------- + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + + +suite() -> [{require,erl_telnet_server,{unix,[telnet]}}]. + +all() -> + [expect, + expect_repeat]. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + +expect(_) -> + {ok, Handle} = ct_telnet:open(erl_telnet_server), + ok = ct_telnet:send(Handle, "echo ayt"), + {ok,["ayt"]} = ct_telnet:expect(Handle, ["ayt"]), + ok = ct_telnet:close(Handle), + ok. + +expect_repeat(_) -> + {ok, Handle} = ct_telnet:open(erl_telnet_server), + ok = ct_telnet:send(Handle, "repeat xy"), + {ok,[["xy"],["xy"]],done} = ct_telnet:expect(Handle, ["xy"], + [{repeat,2}]), + ok = ct_telnet:close(Handle), + ok. -- cgit v1.2.3