mojo/public/tools/mojom/mojom/parse/parser_unittest.py
def testInvalidNullableTypes(self):
    """Tests that invalid nullable types are correctly detected."""
    source1 = """\
        struct MyStruct {
          string?? a;
        };
        """
    with self.assertRaisesRegexp(
        parser.ParseError, r"^my_file\.mojom:2: Error: Unexpected '\?':\n"
        r" *string\?\? a;$"):
      parser.Parse(source1, "my_file.mojom")

    source2 = """\
        struct MyStruct {
          handle?<data_pipe_consumer> a;
        };
        """
    with self.assertRaisesRegexp(
        parser.ParseError, r"^my_file\.mojom:2: Error: Unexpected '<':\n"
        r" *handle\?<data_pipe_consumer> a;$"):
      parser.Parse(source2, "my_file.mojom")

    source3 = """\
        struct MyStruct {
          some_interface?& a;
        };
        """
    with self.assertRaisesRegexp(
        parser.ParseError, r"^my_file\.mojom:2: Error: Unexpected '&':\n"
        r" *some_interface\?& a;$"):
      parser.Parse(source3, "my_file.mojom")
Tests that invalid nullable types are correctly detected.
Tests that invalid nullable types are correctly detected.
Tests that invalid nullable types are correctly detected .
def testInvalidNullableTypes(self):
    source1 = """\
        struct MyStruct {
          string?? a;
        };
        """
    with self.assertRaisesRegexp(
        parser.ParseError, r"^my_file\.mojom:2: Error: Unexpected '\?':\n"
        r" *string\?\? a;$"):
      parser.Parse(source1, "my_file.mojom")
    source2 = """\
        struct MyStruct {
          handle?<data_pipe_consumer> a;
        };
        """
    with self.assertRaisesRegexp(
        parser.ParseError, r"^my_file\.mojom:2: Error: Unexpected '<':\n"
        r" *handle\?<data_pipe_consumer> a;$"):
      parser.Parse(source2, "my_file.mojom")
    source3 = """\
        struct MyStruct {
          some_interface?& a;
        };
        """
    with self.assertRaisesRegexp(
        parser.ParseError, r"^my_file\.mojom:2: Error: Unexpected '&':\n"
        r" *some_interface\?& a;$"):
      parser.Parse(source3, "my_file.mojom")
def testInvalidNullableTypes ( self ) : source1 = """\
        struct MyStruct {
          string?? a;
        };
        """ with self . assertRaisesRegexp ( parser . ParseError , r"^my_file\.mojom:2: Error: Unexpected '\?':\n" r" *string\?\? a;$" ) : parser . Parse ( source1 , "my_file.mojom" ) source2 = """\
        struct MyStruct {
          handle?<data_pipe_consumer> a;
        };
        """ with self . assertRaisesRegexp ( parser . ParseError , r"^my_file\.mojom:2: Error: Unexpected '<':\n" r" *handle\?<data_pipe_consumer> a;$" ) : parser . Parse ( source2 , "my_file.mojom" ) source3 = """\
        struct MyStruct {
          some_interface?& a;
        };
        """ with self . assertRaisesRegexp ( parser . ParseError , r"^my_file\.mojom:2: Error: Unexpected '&':\n" r" *some_interface\?& a;$" ) : parser . Parse ( source3 , "my_file.mojom" )
Tests that invalid nullable types are correctly detected.
Tests that invalid nullable types are correctly detected .
"""Tests that invalid nullable types are correctly detected."""
self