mojo/public/tools/mojom/mojom/parse/parser_unittest.py
def testUnionWithOrdinals(self):
    """Test that ordinals are assigned to fields."""
    source = """\
        module my_module;

        union MyUnion {
          int32 a @10;
          double b @30;
        };
        """
    expected = ast.Mojom(
        ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList(), [
            ast.Union(
                'MyUnion', None,
                ast.UnionBody([
                    ast.UnionField('a', None, ast.Ordinal(10), 'int32'),
                    ast.UnionField('b', None, ast.Ordinal(30), 'double')
                ]))
        ])
    actual = parser.Parse(source, "my_file.mojom")
    self.assertEquals(actual, expected)
Test that ordinals are assigned to fields.
Test that ordinals are assigned to fields.
Test that ordinals are assigned to fields .
def testUnionWithOrdinals(self):
    source = """\
        module my_module;
        union MyUnion {
          int32 a @10;
          double b @30;
        };
        """
    expected = ast.Mojom(
        ast.Module(('IDENTIFIER', 'my_module'), None), ast.ImportList(), [
            ast.Union(
                'MyUnion', None,
                ast.UnionBody([
                    ast.UnionField('a', None, ast.Ordinal(10), 'int32'),
                    ast.UnionField('b', None, ast.Ordinal(30), 'double')
                ]))
        ])
    actual = parser.Parse(source, "my_file.mojom")
    self.assertEquals(actual, expected)
def testUnionWithOrdinals ( self ) : source = """\
        module my_module;

        union MyUnion {
          int32 a @10;
          double b @30;
        };
        """ expected = ast . Mojom ( ast . Module ( ( 'IDENTIFIER' , 'my_module' ) , None ) , ast . ImportList ( ) , [ ast . Union ( 'MyUnion' , None , ast . UnionBody ( [ ast . UnionField ( 'a' , None , ast . Ordinal ( 10 ) , 'int32' ) , ast . UnionField ( 'b' , None , ast . Ordinal ( 30 ) , 'double' ) ] ) ) ] ) actual = parser . Parse ( source , "my_file.mojom" ) self . assertEquals ( actual , expected )
Test that ordinals are assigned to fields.
Test that ordinals are assigned to fields .
"""Test that ordinals are assigned to fields."""
self