mojo/public/tools/mojom/mojom/parse/parser_unittest.py
def testUnionDisallowNestedStruct(self):
    """Tests that structs cannot be nested in unions."""
    source = """\
        module my_module;

        union MyUnion {
          struct MyStruct {
            int32 a;
          };
        };
        """
    with self.assertRaisesRegexp(
        parser.ParseError, r"^my_file\.mojom:4: Error: Unexpected 'struct':\n"
        r" *struct MyStruct {$"):
      parser.Parse(source, "my_file.mojom")
Tests that structs cannot be nested in unions.
Tests that structs cannot be nested in unions.
Tests that structs cannot be nested in unions .
def testUnionDisallowNestedStruct(self):
    source = """\
        module my_module;
        union MyUnion {
          struct MyStruct {
            int32 a;
          };
        };
        """
    with self.assertRaisesRegexp(
        parser.ParseError, r"^my_file\.mojom:4: Error: Unexpected 'struct':\n"
        r" *struct MyStruct {$"):
      parser.Parse(source, "my_file.mojom")
def testUnionDisallowNestedStruct ( self ) : source = """\
        module my_module;

        union MyUnion {
          struct MyStruct {
            int32 a;
          };
        };
        """ with self . assertRaisesRegexp ( parser . ParseError , r"^my_file\.mojom:4: Error: Unexpected 'struct':\n" r" *struct MyStruct {$" ) : parser . Parse ( source , "my_file.mojom" )
Tests that structs cannot be nested in unions.
Tests that structs cannot be nested in unions .
"""Tests that structs cannot be nested in unions."""
self