示例#1
0
    def test_checkFileIgnoresCommentedBlock(self):
        commit = PreCommit(None, None)
        file = open('./resources/clean-java-files/CommentedBlock.java', 'r')
        javaClass = file.read().splitlines()
        actual = commit.checkFile(javaClass)

        self.assertEqual(None, actual)
示例#2
0
    def test_checkIllegalImportsFails(self):
        commit = PreCommit(None, None)
        file = open('./resources/illegal-java-files/IllegalImport.java', 'r')
        javaClass = file.read().splitlines()
        actual = commit.checkFile(javaClass)

        self.assertEqual(ILLEGAL_IMPORT_MSG, actual)
示例#3
0
    def test_checkFileFailsForTestSetupPause(self):
        commit = PreCommit(None, None)
        file = open('./resources/illegal-java-files/Attribute.java', 'r')
        javaClass = file.read().splitlines()
        actual = commit.checkFile(javaClass)

        self.assertEqual(PAUSE_IN_JAVA_FILE_MSG, actual)
示例#4
0
    def test_checkIllegalSoloTestDartFile(self):
        commit = PreCommit(None, None)
        file = open('./resources/illegal-dart-files/IllegalDartTest2.dart',
                    'r')
        actual = commit.checkFile(file.read().splitlines())

        self.assertEqual(SOLO_TEST_MSG, actual)
示例#5
0
    def test_checkIntelliJForm(self):
        commit = PreCommit(None, None)
        file = open(
            './resources/clean-form-files/AttributePropertiesDialog.form', 'r')
        javaClass = file.read().splitlines()
        actual = commit.checkFile(javaClass)

        self.assertEqual(None, actual)
示例#6
0
    def test_checkFileFailsWhenOutsideCommentedBlock(self):
        commit = PreCommit(None, None)
        file = open(
            './resources/illegal-java-files/OutsideCommentedBlock.java', 'r')
        javaClass = file.read().splitlines()
        actual = commit.checkFile(javaClass)

        self.assertEqual(PAUSE_IN_JAVA_FILE_MSG, actual)
示例#7
0
    def test_checkFileFailsForFunctionTestWithPause(self):
        commit = PreCommit(None, None)
        file = open(
            './resources/illegal-java-files/TutorialTextConditions.java', 'r')
        javaClass = file.read().splitlines()
        actual = commit.checkFile(javaClass)

        self.assertEqual(PAUSE_IN_JAVA_FILE_MSG, actual)
示例#8
0
    def test_checkIntelliJFormFails(self):
        commit = PreCommit(None, None)
        file = open(
            './resources/illegal-form-files/AttributePropertiesDialog.form',
            'r')
        javaClass = file.read().splitlines()
        actual = commit.checkFile(javaClass)

        self.assertEqual(INTELLIJ_FORM_WITH_INVALID_REFERENCE_MSG, actual)
示例#9
0
    def test_checkFileIgnoresCommentedLineNotStartingWithForwardSlash(self):
        commit = PreCommit(None, None)
        file = open(
            './resources/clean-java-files/CommentedLineNotStartingWithForwardSlash.java',
            'r')
        javaClass = file.read().splitlines()
        actual = commit.checkFile(javaClass)

        self.assertEqual(None, actual)
示例#10
0
    def test_checkFile(self):
        commit = PreCommit(None, None)
        file = open('./resources/clean-java-files/Attribute.java', 'r')
        actual = commit.checkFile(file.read())

        self.assertEqual(None, actual)
示例#11
0
    def test_checkIllegalSoloTestJSFile(self):
        commit = PreCommit(None, None)
        file = open('./resources/illegal-js-files/IllegalJsSpec2.js', 'r')
        actual = commit.checkFile(file.read().splitlines())

        self.assertEqual(SOLO_TEST_MSG, actual)
示例#12
0
    def test_checkJSFile(self):
        commit = PreCommit(None, None)
        file = open('./resources/clean-js-files/jsSpec.js', 'r')
        actual = commit.checkFile(file.read().splitlines())

        self.assertEqual(None, actual)
示例#13
0
    def test_checkDartFile(self):
        commit = PreCommit(None, None)
        file = open('./resources/clean-dart-files/DartTest.dart', 'r')
        actual = commit.checkFile(file.read().splitlines())

        self.assertEqual(None, actual)