mojo/public/tools/mojom/mojom/parse/parser_unittest.py
def testConsts(self):
    """Tests some constants and struct members initialized with them."""

    source = """\
        module my_module;

        struct MyStruct {
          const int8 kNumber = -1;
          int8 number@0 = kNumber;
        };
        """
    expected = ast.Mojom(
        ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList(), [
            ast.Struct(
                'MyStruct', None,
                ast.StructBody([
                    ast.Const('kNumber', None, 'int8', '-1'),
                    ast.StructField('number', None, ast.Ordinal(0), 'int8',
                                    ('IDENTIFIER', 'kNumber'))
                ]))
        ])
    self.assertEquals(parser.Parse(source, "my_file.mojom"), expected)
Tests some constants and struct members initialized with them.
Tests some constants and struct members initialized with them.
Tests some constants and struct members initialized with them .
def testConsts(self):
    source = """\
        module my_module;
        struct MyStruct {
          const int8 kNumber = -1;
          int8 number@0 = kNumber;
        };
        """
    expected = ast.Mojom(
        ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList(), [
            ast.Struct(
                'MyStruct', None,
                ast.StructBody([
                    ast.Const('kNumber', None, 'int8', '-1'),
                    ast.StructField('number', None, ast.Ordinal(0), 'int8',
                                    ('IDENTIFIER', 'kNumber'))
                ]))
        ])
    self.assertEquals(parser.Parse(source, "my_file.mojom"), expected)
def testConsts ( self ) : source = """\
        module my_module;

        struct MyStruct {
          const int8 kNumber = -1;
          int8 number@0 = kNumber;
        };
        """ expected = ast . Mojom ( ast . Module ( ( 'IDENTIFIER' , 'my_module' ) , None ) , ast . ImportList ( ) , [ ast . Struct ( 'MyStruct' , None , ast . StructBody ( [ ast . Const ( 'kNumber' , None , 'int8' , '-1' ) , ast . StructField ( 'number' , None , ast . Ordinal ( 0 ) , 'int8' , ( 'IDENTIFIER' , 'kNumber' ) ) ] ) ) ] ) self . assertEquals ( parser . Parse ( source , "my_file.mojom" ) , expected )
Tests some constants and struct members initialized with them.
Tests some constants and struct members initialized with them .
"""Tests some constants and struct members initialized with them."""
self