5"""Tests for dartgenerator."""
22 return os.path.exists(
26 return os.path.join(self.
_generator._output_dir,
'src',
'interface',
27 '%s.dart' % interface_name)
33 self.assertTrue(self.
_InOutput(interface_name))
35 f = open(file_path,
'r')
38 return content, file_path
43 header_re = re.compile(
r'^(\s*(//.*|/\*([^*]|\*[^/])*\*/)\s*)*')
44 actual_content = header_re.sub(
'', full_actual_content)
45 if expected_content != actual_content:
52""" % (file_path, expected_content, actual_content)
57 if expected_content
not in actual_content:
60Was found not in output file: %s
63""" % (expected_content, file_path, actual_content)
68 if expected_content
in actual_content:
71Was found in output file: %s
74""" % (expected_content, file_path, actual_content)
93 @A1 @A2 getter attribute int attr;
94 @A1 setter attribute int attr;
96 const long CONSTANT = 1;
97 getter attribute DOMString strAttr;
99 boolean compare(Shape s);
100 Rectangle createRectangle();
101 void addLine(lines::Line line);
102 void someDartType(File file);
103 void someUnidentifiedType(UnidentifiableType t);
109 interface Rectangle : @A3 shapes::Shape {
110 void someTemplatedType(List<Shape> list);
116 interface Line : shapes::Shape {
121 parser = idlparser.IDLParser(idlparser.FREMONTCUT_SYNTAX)
122 ast = parser.parse(content)
124 for interface
in idl_file.interfaces:
125 db.AddInterface(interface)
134 '../templates',
'test')
147 self.assertTrue(self.
_InOutput(
'Rectangle'))
158 self.assertTrue(self.
_InOutput(
'Rectangle'))
164 'Shape',
"""interface Shape {
173 'interface Rectangle extends shapes::Shape')
187 'interface Rectangle extends Forma')
223if __name__ ==
'__main__':
224 logging.config.fileConfig(
'logging.conf')
225 if __name__ ==
'__main__':
_ReadOutputFile(self, interface_name)
testBasicGeneration(self)
testFilterByAnnotations(self)
_InOutput(self, interface_name)
_AssertOutputSansHeaderEquals(self, interface_name, expected_content)
_InDatabase(self, interface_name)
_AssertOutputContains(self, interface_name, expected_content)
_FilePathForDartInterface(self, interface_name)
_AssertOutputDoesNotContain(self, interface_name, expected_content)
testQualifiedDartTypes(self)