~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to lib/erl_interface/test/erl_format_SUITE.erl

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%%
 
2
%% %CopyrightBegin%
 
3
%% 
 
4
%% Copyright Ericsson AB 1997-2011. All Rights Reserved.
 
5
%% 
 
6
%% The contents of this file are subject to the Erlang Public License,
 
7
%% Version 1.1, (the "License"); you may not use this file except in
 
8
%% compliance with the License. You should have received a copy of the
 
9
%% Erlang Public License along with this software. If not, it can be
 
10
%% retrieved online at http://www.erlang.org/.
 
11
%% 
 
12
%% Software distributed under the License is distributed on an "AS IS"
 
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 
14
%% the License for the specific language governing rights and limitations
 
15
%% under the License.
 
16
%% 
 
17
%% %CopyrightEnd%
 
18
%%
 
19
 
 
20
%%
 
21
-module(erl_format_SUITE).
 
22
 
 
23
-include_lib("test_server/include/test_server.hrl").
 
24
-include("erl_format_SUITE_data/format_test_cases.hrl").
 
25
 
 
26
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, 
 
27
         init_per_group/2,end_per_group/2, atoms/1, tuples/1, lists/1]).
 
28
 
 
29
-import(runner, [get_term/1]).
 
30
 
 
31
%% This test suite test the erl_format() function.
 
32
%% It uses the port program "format_test".
 
33
 
 
34
suite() -> [{ct_hooks,[ts_install_cth]}].
 
35
 
 
36
all() -> 
 
37
    [atoms, tuples, lists].
 
38
 
 
39
groups() -> 
 
40
    [].
 
41
 
 
42
init_per_suite(Config) ->
 
43
    Config.
 
44
 
 
45
end_per_suite(_Config) ->
 
46
    ok.
 
47
 
 
48
init_per_group(_GroupName, Config) ->
 
49
    Config.
 
50
 
 
51
end_per_group(_GroupName, Config) ->
 
52
    Config.
 
53
 
 
54
 
 
55
%% Tests formatting various atoms.
 
56
 
 
57
atoms(suite) -> [];
 
58
atoms(Config) when is_list(Config) ->
 
59
    ?line P = runner:start(?atoms),
 
60
 
 
61
    ?line {term, ''} = get_term(P),
 
62
    ?line {term, 'a'} = get_term(P),
 
63
    ?line {term, 'A'} = get_term(P),
 
64
    ?line {term, 'abc'} = get_term(P),
 
65
    ?line {term, 'Abc'} = get_term(P),
 
66
    ?line {term, 'ab@c'} = get_term(P),
 
67
    ?line {term, 'The rain in Spain stays mainly in the plains'} =
 
68
        get_term(P),
 
69
 
 
70
    ?line {term, a} = get_term(P),
 
71
    ?line {term, ab} = get_term(P),
 
72
    ?line {term, abc} = get_term(P),
 
73
    ?line {term, ab@c} = get_term(P),
 
74
    ?line {term, abcdefghijklmnopq} = get_term(P),
 
75
 
 
76
    ?line {term, ''} = get_term(P),
 
77
    ?line {term, 'a'} = get_term(P),
 
78
    ?line {term, 'A'} = get_term(P),
 
79
    ?line {term, 'abc'} = get_term(P),
 
80
    ?line {term, 'Abc'} = get_term(P),
 
81
    ?line {term, 'ab@c'} = get_term(P),
 
82
    ?line {term, 'The rain in Spain stays mainly in the plains'} =
 
83
        get_term(P),
 
84
 
 
85
    ?line {term, a} = get_term(P),
 
86
    ?line {term, ab} = get_term(P),
 
87
    ?line {term, abc} = get_term(P),
 
88
    ?line {term, ab@c} = get_term(P),
 
89
    ?line {term, '   abcdefghijklmnopq   '} = get_term(P),
 
90
 
 
91
    ?line runner:recv_eot(P),
 
92
    ok.
 
93
 
 
94
 
 
95
 
 
96
%% Tests formatting various tuples
 
97
 
 
98
tuples(suite) -> [];
 
99
tuples(Config) when is_list(Config) ->
 
100
    ?line P = runner:start(?tuples),
 
101
 
 
102
    ?line {term, {}} = get_term(P),
 
103
    ?line {term, {a}} = get_term(P),
 
104
    ?line {term, {a, b}} = get_term(P),
 
105
    ?line {term, {a, b, c}} = get_term(P),
 
106
    ?line {term, {1}} = get_term(P),
 
107
    ?line {term, {[]}} = get_term(P),
 
108
    ?line {term, {[], []}} = get_term(P),
 
109
    ?line {term, {[], a, b, c}} = get_term(P),
 
110
    ?line {term, {[], a, [], b, c}} = get_term(P),
 
111
    ?line {term, {[], a, '', b, c}} = get_term(P),
 
112
 
 
113
    ?line runner:recv_eot(P),
 
114
    ok.
 
115
 
 
116
 
 
117
 
 
118
%% Tests formatting various lists
 
119
 
 
120
lists(suite) -> [];
 
121
lists(Config) when is_list(Config) ->
 
122
    ?line P = runner:start(?lists),
 
123
 
 
124
    ?line {term, []} = get_term(P),
 
125
    ?line {term, [a]} = get_term(P),
 
126
    ?line {term, [a, b]} = get_term(P),
 
127
    ?line {term, [a, b, c]} = get_term(P),
 
128
    ?line {term, [1]} = get_term(P),
 
129
    ?line {term, [[]]} = get_term(P),
 
130
    ?line {term, [[], []]} = get_term(P),
 
131
    ?line {term, [[], a, b, c]} = get_term(P),
 
132
    ?line {term, [[], a, [], b, c]} = get_term(P),
 
133
    ?line {term, [[], a, '', b, c]} = get_term(P),
 
134
 
 
135
    ?line {term, [{name, 'Madonna'}, {age, 21}, {data, [{addr, "E-street", 42}]}]} = 
 
136
        get_term(P),
 
137
    case os:type() of
 
138
        vxworks ->
 
139
            ?line {term, [{pi, _}, {'cos(70)', _}]} = get_term(P),
 
140
            ?line {term, [[pi, _], ['cos(70)', _]]} = get_term(P),
 
141
            ?line {term, [[pi, _], [], ["cos(70)", _]]} = 
 
142
                get_term(P);
 
143
        _ ->
 
144
            ?line {term, [{pi, 3.1415}, {'cos(70)', 0.34202}]} = get_term(P),
 
145
            ?line {term, [[pi, 3.1415], ['cos(70)', 0.34202]]} = get_term(P),
 
146
            ?line {term, [[pi, 3.1415], [], ["cos(70)", 0.34202]]} = 
 
147
                get_term(P)
 
148
    end,
 
149
 
 
150
    ?line {term, [-1]} = get_term(P),
 
151
 
 
152
    ?line runner:recv_eot(P),
 
153
    ok.
 
154
 
 
155
 
 
156