import unittest from cvslogprocessor import CVSLogProcessor class Test(unittest.TestCase): def testNewRevision(self): processor = CVSLogProcessor() def testLines(): yield "Checking in accessible/src/base/nsAccessibilityAtomList.h;" yield "/cvsroot/mozilla/accessible/src/base/nsAccessibilityAtomList.h,v <-- nsAccessibilityAtomList.h" yield "new revision: 1.53; previous revision: 1.52" yield "done" parsedLog = processor.shortenCVSLog(testLines()) self.assertEquals(parsedLog[0][0], "mozilla/accessible/src/base/nsAccessibilityAtomList.h") self.assertEquals(parsedLog[0][1], "1.53") def testInitialRevision(self): processor = CVSLogProcessor() def testLines(): yield "RCS file: /cvsroot/mozilla/content/svg/content/src/nsSVGUseElement.h,v" yield "done" yield "Checking in content/svg/content/src/nsSVGUseElement.h;" yield "/cvsroot/mozilla/content/svg/content/src/nsSVGUseElement.h,v <-- nsSVGUseElement.h" yield "initial revision: 1.1" yield "done" parsedLog = processor.shortenCVSLog(testLines()) self.assertEquals(parsedLog[0][0], "mozilla/content/svg/content/src/nsSVGUseElement.h") self.assertEquals(parsedLog[0][1], "1.1") # TODO: check "delete" def testRemove(self): processor = CVSLogProcessor() def testLines(): yield "Removing toolkit/content/nsWidgetStateManager.js;" yield "/cvsroot/mozilla/toolkit/content/nsWidgetStateManager.js,v <-- nsWidgetStateManager.js" yield "new revision: delete; previous revision: 1.11" yield "done" parsedLog = processor.shortenCVSLog(testLines()) self.assertEquals(parsedLog[0][0], "mozilla/toolkit/content/nsWidgetStateManager.js") self.assertEquals(parsedLog[0][1], "delete") if __name__ == "__main__": unittest.main()