30 lines
777 B
Python
30 lines
777 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
import os
|
|
import unittest
|
|
|
|
from tests import utils
|
|
from vsg import vhdlFile
|
|
from vsg.rules import comment
|
|
|
|
sTestDir = os.path.dirname(__file__)
|
|
|
|
lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_012_test_input.vhd"))
|
|
|
|
|
|
class test_comment_rule(unittest.TestCase):
|
|
def setUp(self):
|
|
self.oFile = vhdlFile.vhdlFile(lFile)
|
|
self.assertIsNone(eError)
|
|
|
|
def test_rule_012(self):
|
|
oRule = comment.rule_012()
|
|
self.assertTrue(oRule)
|
|
self.assertEqual(oRule.name, "comment")
|
|
self.assertEqual(oRule.identifier, "012")
|
|
|
|
lExpected = [5, 7]
|
|
|
|
oRule.analyze(self.oFile)
|
|
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
|