1%%
2%% %CopyrightBegin%
3%%
4%% Copyright Ericsson AB 2013-2016. All Rights Reserved.
5%%
6%% Licensed under the Apache License, Version 2.0 (the "License");
7%% you may not use this file except in compliance with the License.
8%% You may obtain a copy of the License at
9%%
10%%     http://www.apache.org/licenses/LICENSE-2.0
11%%
12%% Unless required by applicable law or agreed to in writing, software
13%% distributed under the License is distributed on an "AS IS" BASIS,
14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15%% See the License for the specific language governing permissions and
16%% limitations under the License.
17%%
18%% %CopyrightEnd%
19%%
20-module(test_server_unicode_SUITE).
21
22-export([all/1, init_per_suite/1, end_per_suite/1]).
23-export([init_per_testcase/2, end_per_testcase/2]).
24-export(['#=@: difficult_case_name_äöå'/1,
25	 print_and_log_unicode/1,
26	 print_and_log_latin1/1]).
27
28-include_lib("common_test/include/ct.hrl").
29
30all(suite) ->
31    ['#=@: difficult_case_name_äöå',
32     print_and_log_unicode,
33     print_and_log_latin1].
34
35init_per_suite(Config) ->
36    Config.
37
38end_per_suite(_Config) ->
39    ok.
40
41init_per_testcase(_Case,Config) ->
42    init_timetrap(500,Config).
43
44init_timetrap(T,Config) ->
45    Dog = test_server:timetrap(T),
46    [{watchdog, Dog}|Config].
47
48end_per_testcase(_Case,Config) ->
49    cancel_timetrap(Config).
50
51cancel_timetrap(Config) ->
52    Dog=?config(watchdog, Config),
53    test_server:timetrap_cancel(Dog),
54    ok.
55
56
57%%%-----------------------------------------------------------------
58%%% Test cases
59
60'#=@: difficult_case_name_äöå'(Config) when is_list(Config) ->
61    ok.
62
63print_and_log_unicode(Config) when is_list(Config) ->
64    String = "שלום-שלום+של 日本語",
65    test_server:comment(String),
66    test_server:capture_start(),
67    io:format("String with ts: ~ts",[String]),
68    test_server:capture_stop(),
69    "String with ts: "++String = lists:flatten(test_server:capture_get()),
70    ok.
71
72print_and_log_latin1(Config) when is_list(Config) ->
73    String = "æøå",
74    test_server:comment(String),
75    test_server:capture_start(),
76    io:format("String with s: ~s",[String]),
77    io:format("String with ts: ~ts",[String]),
78    test_server:capture_stop(),
79    ["String with s: "++String,
80     "String with ts: "++String] =
81	[lists:flatten(L) || L<- test_server:capture_get()],
82    ok.
83