blob: 9076ffb61378bc6ede52cd7057184c29fbee0056 [file] [log] [blame]
Jens Geyer6d15c302014-10-02 10:03:09 +02001%%
2%% Licensed to the Apache Software Foundation (ASF) under one
3%% or more contributor license agreements. See the NOTICE file
4%% distributed with this work for additional information
5%% regarding copyright ownership. The ASF licenses this file
6%% to you under the Apache License, Version 2.0 (the
7%% "License"); you may not use this file except in compliance
8%% with the License. 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,
13%% software distributed under the License is distributed on an
14%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15%% KIND, either express or implied. See the License for the
16%% specific language governing permissions and limitations
17%% under the License.
18%%
19
20-module(legacy_names_test).
Jens Geyer6d15c302014-10-02 10:03:09 +020021
22-include_lib("eunit/include/eunit.hrl").
23
Nobuaki Sukegawa826ea992015-10-28 22:19:45 +090024-include("gen-erl/legacyNames_constants.hrl").
Jens Geyer6d15c302014-10-02 10:03:09 +020025
26record_generation_test_() ->
Sergei Elin45764092022-09-23 23:21:31 +030027 [
28 {"capitalizedStruct record",
29 ?_assertMatch(
30 {capitalizedStruct, _, _},
31 #capitalizedStruct{id = null, message = null}
32 )}
33 ].
Jens Geyer6d15c302014-10-02 10:03:09 +020034
35struct_info_test_() ->
Sergei Elin45764092022-09-23 23:21:31 +030036 [
37 {"capitalizedStruct extended definition",
38 ?_assertEqual(
39 {struct, [
40 {1, undefined, i32, 'id', undefined},
41 {2, undefined, string, 'message', undefined}
42 ]},
43 legacyNames_types:struct_info_ext(capitalizedStruct)
44 )},
45 {"listCapitalizedStructs extended definition",
46 ?_assertEqual(
47 {struct, [
48 {1, undefined, {list, {struct, {'legacyNames_types', 'capitalizedStruct'}}},
49 'structs', []}
50 ]},
51 legacyNames_types:struct_info_ext(listCapitalizedStructs)
52 )}
53 ].
Jens Geyer6d15c302014-10-02 10:03:09 +020054
55service_info_test_() ->
Sergei Elin45764092022-09-23 23:21:31 +030056 [
57 {"names params",
58 ?_assertEqual(
59 {struct, [
60 {1, {struct, {'legacyNames_types', 'capitalizedStruct'}}},
61 {2, {struct, {'legacyNames_types', 'capitalizedStruct'}}}
62 ]},
63 legacyNames_thrift:function_info(names, params_type)
64 )},
65 {"names reply",
66 ?_assertEqual(
67 {struct, {'legacyNames_types', 'listCapitalizedStructs'}},
68 legacyNames_thrift:function_info(names, reply_type)
69 )},
70 {"names exceptions",
71 ?_assertEqual(
72 {struct, [{1, {struct, {'legacyNames_types', 'xception'}}}]},
73 legacyNames_thrift:function_info(names, exceptions)
74 )}
75 ].