1-module(config_encoding_SUITE). 2 3-include("testsuite.hrl"). 4 5-compile(export_all). 6 7all() -> 8 [ 9 bad_encoding, 10 good_encoding 11 ]. 12 13groups() -> 14 [ 15 ]. 16 17%%==================================================================== 18init_per_suite(Config) -> 19 Config. 20 21end_per_suite(_Config) -> 22 ok. 23 24init_per_group(_Group, Config) -> 25 Config. 26 27end_per_group(_Group, _Config) -> 28 ok. 29 30init_per_testcase(_Test, Config) -> 31 Config. 32 33end_per_testcase(_Test, _Config) -> 34 ok. 35 36%%==================================================================== 37bad_encoding(_Config) -> 38 Enc = case file:native_name_encoding() of 39 latin1 -> unicode; 40 utf8 -> latin1 41 end, 42 Env = #env{debug = false, 43 encoding = Enc, 44 conf = {file, ?tempdir(?MODULE) ++ "/yaws_unicode.conf"}}, 45 {error, _} = yaws_config:load(Env), 46 ok. 47 48good_encoding(_Config) -> 49 Enc = case file:native_name_encoding() of 50 latin1 -> latin1; 51 utf8 -> unicode 52 end, 53 Env = #env{debug = false, 54 encoding = Enc, 55 conf = {file, ?tempdir(?MODULE) ++ "/yaws_unicode.conf"}}, 56 {ok, _, _} = yaws_config:load(Env), 57 ok. 58