mojo/public/tools/mojom/mojom/parse/parser_unittest.py
def testValidStructDefinitions(self):
    """Tests all types of definitions that can occur in a struct."""

    source = """\
        struct MyStruct {
          enum MyEnum { VALUE };
          const double kMyConst = 1.23;
          int32 a;
          SomeOtherStruct b;  // Invalidity detected at another stage.
        };
        """
    expected = ast.Mojom(None, ast.ImportList(), [
        ast.Struct(
            'MyStruct', None,
            ast.StructBody([
                ast.Enum('MyEnum', None,
                         ast.EnumValueList(ast.EnumValue('VALUE', None, None))),
                ast.Const('kMyConst', None, 'double', '1.23'),
                ast.StructField('a', None, None, 'int32', None),
                ast.StructField('b', None, None, 'SomeOtherStruct', None)
            ]))
    ])
    self.assertEquals(parser.Parse(source, "my_file.mojom"), expected)
Tests all types of definitions that can occur in a struct.
Tests all types of definitions that can occur in a struct.
Tests all types of definitions that can occur in a struct .
def testValidStructDefinitions(self):
    source = """\
        struct MyStruct {
          enum MyEnum { VALUE };
          const double kMyConst = 1.23;
          int32 a;
          SomeOtherStruct b;  // Invalidity detected at another stage.
        };
        """
    expected = ast.Mojom(None, ast.ImportList(), [
        ast.Struct(
            'MyStruct', None,
            ast.StructBody([
                ast.Enum('MyEnum', None,
                         ast.EnumValueList(ast.EnumValue('VALUE', None, None))),
                ast.Const('kMyConst', None, 'double', '1.23'),
                ast.StructField('a', None, None, 'int32', None),
                ast.StructField('b', None, None, 'SomeOtherStruct', None)
            ]))
    ])
    self.assertEquals(parser.Parse(source, "my_file.mojom"), expected)
def testValidStructDefinitions ( self ) : source = """\
        struct MyStruct {
          enum MyEnum { VALUE };
          const double kMyConst = 1.23;
          int32 a;
          SomeOtherStruct b;  // Invalidity detected at another stage.
        };
        """ expected = ast . Mojom ( None , ast . ImportList ( ) , [ ast . Struct ( 'MyStruct' , None , ast . StructBody ( [ ast . Enum ( 'MyEnum' , None , ast . EnumValueList ( ast . EnumValue ( 'VALUE' , None , None ) ) ) , ast . Const ( 'kMyConst' , None , 'double' , '1.23' ) , ast . StructField ( 'a' , None , None , 'int32' , None ) , ast . StructField ( 'b' , None , None , 'SomeOtherStruct' , None ) ] ) ) ] ) self . assertEquals ( parser . Parse ( source , "my_file.mojom" ) , expected )
Tests all types of definitions that can occur in a struct.
Tests all types of definitions that can occur in a struct .
"""Tests all types of definitions that can occur in a struct."""
self