149 def test_merge(self):
150 file_name1 = self._create_input(
151 'input1.idl', '''
152 module M {
153 interface I {
154 const int CONST_BOTH = 0;
155 const int CONST_ONLY_FIRST = 0;
156 const int CONST_BOTH_DIFFERENT_VALUE = 0;
157
158 readonly attribute int attr_only_first;
159 readonly attribute int attr_both;
160 readonly attribute int attr_both_readonly_difference;
161 readonly attribute int attr_both_int_long_difference;
162
163 int op_only_first();
164 int op_both(int a);
165 int op_both_optionals_difference(int a,
166 in optional int b);
167 int op_both_arg_rename(int arg);
168 };
169 };''')
170 self._builder.import_idl_file(
171 file_name1,
172 DatabaseBuilderOptions(
173 source='1st', idl_syntax=idlparser.FREMONTCUT_SYNTAX))
174 file_name2 = self._create_input(
175 'input2.idl', '''
176 module M {
177 interface I {
178 const int CONST_BOTH = 0;
179 const int CONST_ONLY_SECOND = 0;
180 const int CONST_BOTH_DIFFERENT_VALUE = 1;
181
182 readonly attribute int attr_only_second;
183 readonly attribute int attr_both;
184 readonly attribute long attr_both_int_long_difference;
185 attribute int attr_both_readonly_difference;
186
187 int op_only_second();
188 int op_both(int a);
189 int op_both_optionals_difference(int a,
190 optional boolean b);
191 int op_both_arg_rename(int betterName);
192 };
193 };''')
194 self._builder.import_idl_file(
195 file_name2,
196 DatabaseBuilderOptions(
197 source='2nd', idl_syntax=idlparser.FREMONTCUT_SYNTAX))
198 self._builder.set_same_signatures({'int': 'long'})
199 self._builder.merge_imported_interfaces([])
200 self._db.Save()
201 self._assert_content_equals(
202 'I.idl', '''
203 @1st(module=M) @2nd(module=M) interface I {
204 /* Constants */
205 @1st @2nd const int CONST_BOTH = 0;
206 @1st const int CONST_BOTH_DIFFERENT_VALUE = 0;
207 @2nd const int CONST_BOTH_DIFFERENT_VALUE = 1;
208 @1st const int CONST_ONLY_FIRST = 0;
209 @2nd const int CONST_ONLY_SECOND = 0;
210
211 /* Attributes */
212 @1st @2nd getter attribute int attr_both;
213 @1st @2nd getter attribute int attr_both_int_long_difference;
214 @1st @2nd getter attribute int attr_both_readonly_difference;
215 @2nd setter attribute int attr_both_readonly_difference;
216 @1st getter attribute int attr_only_first;
217 @2nd getter attribute int attr_only_second;
218
219 /* Operations */
220 @1st @2nd int op_both(in t a);
221 @1st @2nd int op_both_arg_rename(in t betterName);
222 @1st @2nd int op_both_optionals_difference(in t a);
223 @1st int op_both_optionals_difference(in t a, in int b);
224 @2nd int op_both_optionals_difference(in t a, in boolean b);
225 @1st int op_only_first();
226 @2nd int op_only_second();
227 };''')
228