mojo/public/tools/mojom/mojom/parse/parser_unittest.py
def testSimpleOrdinals(self):
    """Tests that (valid) ordinal values are scanned correctly."""

    source = """\
        module my_module;

        // This isn't actually valid .mojom, but the problem (missing ordinals)
        // should be handled at a different level.
        struct MyStruct {
          int32 a0@0;
          int32 a1@1;
          int32 a2@2;
          int32 a9@9;
          int32 a10 @10;
          int32 a11 @11;
          int32 a29 @29;
          int32 a1234567890 @1234567890;
        };
        """
    expected = ast.Mojom(
        ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList(), [
            ast.Struct(
                'MyStruct', None,
                ast.StructBody([
                    ast.StructField('a0', None, ast.Ordinal(0), 'int32', None),
                    ast.StructField('a1', None, ast.Ordinal(1), 'int32', None),
                    ast.StructField('a2', None, ast.Ordinal(2), 'int32', None),
                    ast.StructField('a9', None, ast.Ordinal(9), 'int32', None),
                    ast.StructField('a10', None, ast.Ordinal(10), 'int32',
                                    None),
                    ast.StructField('a11', None, ast.Ordinal(11), 'int32',
                                    None),
                    ast.StructField('a29', None, ast.Ordinal(29), 'int32',
                                    None),
                    ast.StructField('a1234567890', None,
                                    ast.Ordinal(1234567890), 'int32', None)
                ]))
        ])
    self.assertEquals(parser.Parse(source, "my_file.mojom"), expected)
Tests that (valid) ordinal values are scanned correctly.
Tests that (valid) ordinal values are scanned correctly.
Tests that ( valid ) ordinal values are scanned correctly .
def testSimpleOrdinals(self):
    source = """\
        module my_module;
        // This isn't actually valid .mojom, but the problem (missing ordinals)
        // should be handled at a different level.
        struct MyStruct {
          int32 a0@0;
          int32 a1@1;
          int32 a2@2;
          int32 a9@9;
          int32 a10 @10;
          int32 a11 @11;
          int32 a29 @29;
          int32 a1234567890 @1234567890;
        };
        """
    expected = ast.Mojom(
        ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList(), [
            ast.Struct(
                'MyStruct', None,
                ast.StructBody([
                    ast.StructField('a0', None, ast.Ordinal(0), 'int32', None),
                    ast.StructField('a1', None, ast.Ordinal(1), 'int32', None),
                    ast.StructField('a2', None, ast.Ordinal(2), 'int32', None),
                    ast.StructField('a9', None, ast.Ordinal(9), 'int32', None),
                    ast.StructField('a10', None, ast.Ordinal(10), 'int32',
                                    None),
                    ast.StructField('a11', None, ast.Ordinal(11), 'int32',
                                    None),
                    ast.StructField('a29', None, ast.Ordinal(29), 'int32',
                                    None),
                    ast.StructField('a1234567890', None,
                                    ast.Ordinal(1234567890), 'int32', None)
                ]))
        ])
    self.assertEquals(parser.Parse(source, "my_file.mojom"), expected)
def testSimpleOrdinals ( self ) : source = """\
        module my_module;

        // This isn't actually valid .mojom, but the problem (missing ordinals)
        // should be handled at a different level.
        struct MyStruct {
          int32 a0@0;
          int32 a1@1;
          int32 a2@2;
          int32 a9@9;
          int32 a10 @10;
          int32 a11 @11;
          int32 a29 @29;
          int32 a1234567890 @1234567890;
        };
        """ expected = ast . Mojom ( ast . Module ( ( 'IDENTIFIER' , 'my_module' ) , None ) , ast . ImportList ( ) , [ ast . Struct ( 'MyStruct' , None , ast . StructBody ( [ ast . StructField ( 'a0' , None , ast . Ordinal ( 0 ) , 'int32' , None ) , ast . StructField ( 'a1' , None , ast . Ordinal ( 1 ) , 'int32' , None ) , ast . StructField ( 'a2' , None , ast . Ordinal ( 2 ) , 'int32' , None ) , ast . StructField ( 'a9' , None , ast . Ordinal ( 9 ) , 'int32' , None ) , ast . StructField ( 'a10' , None , ast . Ordinal ( 10 ) , 'int32' , None ) , ast . StructField ( 'a11' , None , ast . Ordinal ( 11 ) , 'int32' , None ) , ast . StructField ( 'a29' , None , ast . Ordinal ( 29 ) , 'int32' , None ) , ast . StructField ( 'a1234567890' , None , ast . Ordinal ( 1234567890 ) , 'int32' , None ) ] ) ) ] ) self . assertEquals ( parser . Parse ( source , "my_file.mojom" ) , expected )
Tests that (valid) ordinal values are scanned correctly.
Tests that ( valid ) ordinal values are scanned correctly .
"""Tests that (valid) ordinal values are scanned correctly."""
self