OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 import database | 6 import database |
7 import idlparser | 7 import idlparser |
8 import logging.config | 8 import logging.config |
9 import os | 9 import os |
10 import os.path | 10 import os.path |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 getter attribute int a; | 90 getter attribute int a; |
91 | 91 |
92 /* Operations */ | 92 /* Operations */ |
93 int o(in int x); | 93 int o(in int x); |
94 int o(in int x, in int y); | 94 int o(in int x, in int y); |
95 };''') | 95 };''') |
96 | 96 |
97 def test_renames(self): | 97 def test_renames(self): |
98 file_name = self._create_input('input.idl', ''' | 98 file_name = self._create_input('input.idl', ''' |
99 module M { | 99 module M { |
100 interface I { | 100 [Constructor(in T x)] interface I { |
101 T op(T x); | 101 T op(T x); |
102 readonly attribute N::T attr; | 102 readonly attribute N::T attr; |
103 }; | 103 }; |
104 };''') | 104 };''') |
105 options = DatabaseBuilderOptions(type_rename_map={'I': 'i', 'T': 't'}) | 105 options = DatabaseBuilderOptions(type_rename_map={'I': 'i', 'T': 't'}) |
106 self._builder.import_idl_file(file_name, options) | 106 self._builder.import_idl_file(file_name, options) |
107 self._builder.merge_imported_interfaces([]) | 107 self._builder.merge_imported_interfaces([]) |
108 self._db.Save() | 108 self._db.Save() |
109 self._assert_content_equals('i.idl', ''' | 109 self._assert_content_equals('i.idl', ''' |
110 interface i { | 110 [Constructor(in t x)] interface i { |
111 /* Attributes */ | 111 /* Attributes */ |
112 getter attribute t attr; | 112 getter attribute t attr; |
113 /* Operations */ | 113 /* Operations */ |
114 t op(in t x); | 114 t op(in t x); |
115 };''') | 115 };''') |
116 | 116 |
117 def test_type_defs(self): | 117 def test_type_defs(self): |
118 file_name = self._create_input('input.idl', ''' | 118 file_name = self._create_input('input.idl', ''' |
119 module M { | 119 module M { |
120 typedef T S; | 120 typedef T S; |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 @1st | 378 @1st |
379 @2nd(via=I) | 379 @2nd(via=I) |
380 getter attribute int attr; | 380 getter attribute int attr; |
381 };''') | 381 };''') |
382 | 382 |
383 | 383 |
384 if __name__ == "__main__": | 384 if __name__ == "__main__": |
385 logging.config.fileConfig("logging.conf") | 385 logging.config.fileConfig("logging.conf") |
386 if __name__ == '__main__': | 386 if __name__ == '__main__': |
387 unittest.main() | 387 unittest.main() |
OLD | NEW |