aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_own_server_SUITE.erl
blob: 2173c68c11af69ba9bd23b3dac806f4af9064e06 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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.