コード例 #1
0
    def test_rule_023(self):
        oRule = instantiation.rule_023()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'instantiation')
        self.assertEqual(oRule.identifier, '023')

        dExpected = utils.add_violation_list([24, 29, 31])
        oRule.analyze(oFileComment)
        self.assertEqual(oRule.violations, dExpected)
コード例 #2
0
    def test_fix_rule_023(self):
        oRule = instantiation.rule_023()

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
コード例 #3
0
    def test_rule_023(self):
        oRule = instantiation.rule_023()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, 'instantiation')
        self.assertEqual(oRule.identifier, '023')

        lExpected = [9, 11, 13, 18, 20, 22]

        oRule.analyze(self.oFile)
        self.assertEqual(
            lExpected,
            utils.extract_violation_lines_from_violation_object(
                oRule.violations))
コード例 #4
0
 def test_fix_rule_023(self):
     oRule = instantiation.rule_023()
     oRule.fix(oFileComment)
     oRule.analyze(oFileComment)
     self.assertEqual(oRule.violations, [])
     self.assertEqual(oFileComment.lines[24].line,
                      '      generic_1 => \'0\',')
     self.assertFalse(oFileComment.lines[24].hasComment)
     self.assertFalse(oFileComment.lines[24].hasInlineComment)
     self.assertEqual(oFileComment.lines[29].line, '      port_2 => \'1\',')
     self.assertFalse(oFileComment.lines[29].hasComment)
     self.assertFalse(oFileComment.lines[29].hasInlineComment)
     self.assertEqual(oFileComment.lines[31].line, '      port_4 => \'1\'')
     self.assertFalse(oFileComment.lines[31].hasComment)
     self.assertFalse(oFileComment.lines[31].hasInlineComment)