def testAddFooterChangeId(self): with self.assertRaises(AssertionError): git_footers.add_footer_change_id('Already has\n\nChange-Id: Ixxx', 'Izzz') self.assertEqual( git_footers.add_footer_change_id('header-only', 'Ixxx'), 'header-only\n\nChange-Id: Ixxx') self.assertEqual( git_footers.add_footer_change_id('header\n\nsome: footer', 'Ixxx'), 'header\n\nsome: footer\nChange-Id: Ixxx') self.assertEqual( git_footers.add_footer_change_id('header\n\nBUG: yy', 'Ixxx'), 'header\n\nBUG: yy\nChange-Id: Ixxx') self.assertEqual( git_footers.add_footer_change_id('header\n\nBUG: yy\nPos: 1', 'Ixxx'), 'header\n\nBUG: yy\nChange-Id: Ixxx\nPos: 1') self.assertEqual( git_footers.add_footer_change_id('header\n\nBUG: yy\n\nPos: 1', 'Ixxx'), 'header\n\nBUG: yy\n\nPos: 1\nChange-Id: Ixxx') # Special case: first line is never a footer, even if it looks line one. self.assertEqual( git_footers.add_footer_change_id('header: like footer', 'Ixxx'), 'header: like footer\n\nChange-Id: Ixxx') self.assertEqual( git_footers.add_footer_change_id('Header.\n\nBug: v8\nN=t\nT=z', 'Ix'), 'Header.\n\nBug: v8\nChange-Id: Ix\nN=t\nT=z')
def testAddFooterChangeId(self): self.assertEqual( git_footers.add_footer_change_id('header-only', 'Ixxx'), 'header-only\n\nChange-Id: Ixxx') self.assertEqual( git_footers.add_footer_change_id('header\n\nsome: footter', 'Ixxx'), 'header\n\nChange-Id: Ixxx\nsome: footter') self.assertEqual( git_footers.add_footer_change_id('header\n\nBUG: yy', 'Ixxx'), 'header\n\nBUG: yy\nChange-Id: Ixxx') self.assertEqual( git_footers.add_footer_change_id('header\n\nBUG: yy\nPos: 1', 'Ixxx'), 'header\n\nBUG: yy\nChange-Id: Ixxx\nPos: 1') self.assertEqual( git_footers.add_footer_change_id('header\n\nBUG: yy\n\nPos: 1', 'Ixxx'), 'header\n\nBUG: yy\n\nChange-Id: Ixxx\nPos: 1') # Special case: first line is never a footer, even if it looks line one. self.assertEqual( git_footers.add_footer_change_id('header: like footer', 'Ixxx'), 'header: like footer\n\nChange-Id: Ixxx')