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

    source = """\
        interface MyInterface {
          enum MyEnum { VALUE };
          const int32 kMyConst = 123;
          MyMethod(int32 x) => (MyEnum y);
        };
        """
    expected = ast.Mojom(None, ast.ImportList(), [
        ast.Interface(
            'MyInterface', None,
            ast.InterfaceBody([
                ast.Enum('MyEnum', None,
                         ast.EnumValueList(ast.EnumValue('VALUE', None, None))),
                ast.Const('kMyConst', None, 'int32', '123'),
                ast.Method(
                    'MyMethod', None, None,
                    ast.ParameterList(ast.Parameter('x', None, None, 'int32')),
                    ast.ParameterList(ast.Parameter('y', None, None, 'MyEnum')))
            ]))
    ])
    self.assertEquals(parser.Parse(source, "my_file.mojom"), expected)
Tests all types of definitions that can occur in an interface.
Tests all types of definitions that can occur in an interface.
Tests all types of definitions that can occur in an interface .
def testValidInterfaceDefinitions(self):
    source = """\
        interface MyInterface {
          enum MyEnum { VALUE };
          const int32 kMyConst = 123;
          MyMethod(int32 x) => (MyEnum y);
        };
        """
    expected = ast.Mojom(None, ast.ImportList(), [
        ast.Interface(
            'MyInterface', None,
            ast.InterfaceBody([
                ast.Enum('MyEnum', None,
                         ast.EnumValueList(ast.EnumValue('VALUE', None, None))),
                ast.Const('kMyConst', None, 'int32', '123'),
                ast.Method(
                    'MyMethod', None, None,
                    ast.ParameterList(ast.Parameter('x', None, None, 'int32')),
                    ast.ParameterList(ast.Parameter('y', None, None, 'MyEnum')))
            ]))
    ])
    self.assertEquals(parser.Parse(source, "my_file.mojom"), expected)
def testValidInterfaceDefinitions ( self ) : source = """\
        interface MyInterface {
          enum MyEnum { VALUE };
          const int32 kMyConst = 123;
          MyMethod(int32 x) => (MyEnum y);
        };
        """ expected = ast . Mojom ( None , ast . ImportList ( ) , [ ast . Interface ( 'MyInterface' , None , ast . InterfaceBody ( [ ast . Enum ( 'MyEnum' , None , ast . EnumValueList ( ast . EnumValue ( 'VALUE' , None , None ) ) ) , ast . Const ( 'kMyConst' , None , 'int32' , '123' ) , ast . Method ( 'MyMethod' , None , None , ast . ParameterList ( ast . Parameter ( 'x' , None , None , 'int32' ) ) , ast . ParameterList ( ast . Parameter ( 'y' , None , None , 'MyEnum' ) ) ) ] ) ) ] ) self . assertEquals ( parser . Parse ( source , "my_file.mojom" ) , expected )
Tests all types of definitions that can occur in an interface.
Tests all types of definitions that can occur in an interface .
"""Tests all types of definitions that can occur in an interface."""
self