mojo/public/tools/mojom/check_stable_mojom_compatibility_unittest.py
def testWithMovedDefinition(self):
    """If a definition moves from one file to another, we should still be able
    to check compatibility accurately."""
    self.assertBackwardCompatible([
        Change('foo/foo.mojom',
               old="""\
               module foo;
               [Stable] struct S {};
               """,
               new="""\
               module foo;
               """),
        Change('bar/bar.mojom',
               old="""\
               module bar;
               import "foo/foo.mojom";
               [Stable] struct T { foo.S s; };
               """,
               new="""\
               module bar;
               import "foo/foo.mojom";
               [Stable, RenamedFrom="foo.S"] struct S {
                 [MinVersion=2] int32 x;
               };
               [Stable] struct T { S s; [MinVersion=1] int32 y; };
               """)
    ])

    self.assertNotBackwardCompatible([
        Change('foo/foo.mojom',
               old="""\
               module foo;
               [Stable] struct S {};
               """,
               new="""\
               module foo;
               """),
        Change('bar/bar.mojom',
               old="""\
               module bar;
               import "foo/foo.mojom";
               [Stable] struct T { foo.S s; };
               """,
               new="""\
               module bar;
               import "foo/foo.mojom";
               [Stable, RenamedFrom="foo.S"] struct S { int32 x; };
               [Stable] struct T { S s; [MinVersion=1] int32 y; };
               """)
    ])
If a definition moves from one file to another, we should still be able
    to check compatibility accurately.
If a definition moves from one file to another, we should still be able
to check compatibility accurately.
If a definition moves from one file to another we should still be able to check compatibility accurately .
def testWithMovedDefinition(self):
    self.assertBackwardCompatible([
        Change('foo/foo.mojom',
               old="""\
               module foo;
               [Stable] struct S {};
               """,
               new="""\
               module foo;
               """),
        Change('bar/bar.mojom',
               old="""\
               module bar;
               import "foo/foo.mojom";
               [Stable] struct T { foo.S s; };
               """,
               new="""\
               module bar;
               import "foo/foo.mojom";
               [Stable, RenamedFrom="foo.S"] struct S {
                 [MinVersion=2] int32 x;
               };
               [Stable] struct T { S s; [MinVersion=1] int32 y; };
               """)
    ])
    self.assertNotBackwardCompatible([
        Change('foo/foo.mojom',
               old="""\
               module foo;
               [Stable] struct S {};
               """,
               new="""\
               module foo;
               """),
        Change('bar/bar.mojom',
               old="""\
               module bar;
               import "foo/foo.mojom";
               [Stable] struct T { foo.S s; };
               """,
               new="""\
               module bar;
               import "foo/foo.mojom";
               [Stable, RenamedFrom="foo.S"] struct S { int32 x; };
               [Stable] struct T { S s; [MinVersion=1] int32 y; };
               """)
    ])
def testWithMovedDefinition ( self ) : self . assertBackwardCompatible ( [ Change ( 'foo/foo.mojom' , old = """\
               module foo;
               [Stable] struct S {};
               """ , new = """\
               module foo;
               """ ) , Change ( 'bar/bar.mojom' , old = """\
               module bar;
               import "foo/foo.mojom";
               [Stable] struct T { foo.S s; };
               """ , new = """\
               module bar;
               import "foo/foo.mojom";
               [Stable, RenamedFrom="foo.S"] struct S {
                 [MinVersion=2] int32 x;
               };
               [Stable] struct T { S s; [MinVersion=1] int32 y; };
               """ ) ] ) self . assertNotBackwardCompatible ( [ Change ( 'foo/foo.mojom' , old = """\
               module foo;
               [Stable] struct S {};
               """ , new = """\
               module foo;
               """ ) , Change ( 'bar/bar.mojom' , old = """\
               module bar;
               import "foo/foo.mojom";
               [Stable] struct T { foo.S s; };
               """ , new = """\
               module bar;
               import "foo/foo.mojom";
               [Stable, RenamedFrom="foo.S"] struct S { int32 x; };
               [Stable] struct T { S s; [MinVersion=1] int32 y; };
               """ ) ] )
If a definition moves from one file to another, we should still be able
to check compatibility accurately.
If a definition moves from one file to another we should still be able to check compatibility accurately .
"""If a definition moves from one file to another, we should still be able
    to check compatibility accurately."""
self