Пример #1
0
    def testCanPunchClone(self):
        self.setUpProject("scunchWithClone")
        scmWork = self.scmWork

        testScunchWithClonePath = self.createTestFolder("testScunch")
        scmWork.exportTo(testScunchWithClonePath, clear=True)

        scunch.scunch(testScunchWithClonePath, scmWork)
        self.assertNonNormalStatus({})
Пример #2
0
    def testCanPunchModifiedFiles(self):
        self.setUpProject("scunchWithChanges")
        scmWork = self.scmWork

        testScunchWithChangesPath = self.createTestFolder("testScunch")
        scmWork.exportTo(testScunchWithChangesPath, clear=True)

        readMeTooPath = os.path.join(testScunchWithChangesPath, "ReadMeToo.txt")
        self.writeTextFile(readMeTooPath, ["You really should", "read me, too."])
        whilePyPath = os.path.join(testScunchWithChangesPath, "loops", "while.py")
        os.remove(whilePyPath)

        scunch.scunch(testScunchWithChangesPath, scmWork)
        self.assertNonNormalStatus({scunch.ScmStatus.Added: 1, scunch.ScmStatus.Removed: 1})
Пример #3
0
    def _testTextOptions(self, textOptions=None, expectedTextFileContents={}):
        scmWork = self.scmWork
        # Create a folder with a couple of messed up text files.
        _tools.makeFolder(self.textsFolderPath)
        self.writeBinaryFile(self.dosNewLineTxtPath, "1\r\n2\r\n")
        self.writeBinaryFile(self.unixNewLineTxtPath, "1\n2\n")
        self.writeBinaryFile(self.mixedNewLineTxtPath, "1\r\n2\n3\r")
        self.writeBinaryFile(self.mixedNewLineTxtPath, "1\r\n2\n3\r\n4\n")
        self.writeBinaryFile(self.noNewLineTxtPath, "1")
        self.writeBinaryFile(self.tabAndTrailingSpaceTxtPath, ".\t1 \n")
        self.writeBinaryFile(self.emptyTxtPath, "")

        scunch.scunch(self.testPunchTextPath, scmWork, textOptions=textOptions)

        for filePathToTest, expectedContent in expectedTextFileContents.items():
            self._assertWorkTextFileEquals(filePathToTest, expectedContent)

        scmWork.addUnversioned("")
        self.assertNonNormalStatus({scunch.ScmStatus.Added: 1 + len(expectedTextFileContents)})
        self._testAfterPunch(self.testPunchTextPath, textOptions)