File: config_encoding_SUITE.erl

package info (click to toggle)
yaws 2.1.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,012 kB
  • sloc: erlang: 42,153; sh: 2,501; javascript: 1,459; makefile: 968; ansic: 890; lisp: 79; python: 34; xml: 12; php: 1
file content (57 lines) | stat: -rw-r--r-- 1,253 bytes parent folder | download | duplicates (2)
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
47
48
49
50
51
52
53
54
55
56
57
-module(config_encoding_SUITE).

-include("testsuite.hrl").

-compile(export_all).

all() ->
    [
     bad_encoding,
     good_encoding
    ].

groups() ->
    [
    ].

%%====================================================================
init_per_suite(Config) ->
    Config.

end_per_suite(_Config) ->
    ok.

init_per_group(_Group, Config) ->
    Config.

end_per_group(_Group, _Config) ->
    ok.

init_per_testcase(_Test, Config) ->
    Config.

end_per_testcase(_Test, _Config) ->
    ok.

%%====================================================================
bad_encoding(_Config) ->
    Enc = case file:native_name_encoding() of
              latin1 -> unicode;
              utf8   -> latin1
          end,
    Env = #env{debug    = false,
               encoding = Enc,
               conf     = {file, ?tempdir(?MODULE) ++ "/yaws_unicode.conf"}},
    {error, _} = yaws_config:load(Env),
    ok.

good_encoding(_Config) ->
    Enc = case file:native_name_encoding() of
              latin1 -> latin1;
              utf8   -> unicode
          end,
    Env = #env{debug    = false,
               encoding = Enc,
               conf     = {file, ?tempdir(?MODULE) ++ "/yaws_unicode.conf"}},
    {ok, _, _} = yaws_config:load(Env),
    ok.