Issue#1330 Added tests for new package instantiation naming rules.

This commit is contained in:
Jukka Hertzog 2024-11-14 10:57:32 +00:00 committed by GitHub
parent b820d1f914
commit 27051dd201
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 88 additions and 0 deletions

View File

@ -0,0 +1,15 @@
package foo is new my_generic_pkg
generic map (
g_my_generic => 2
);
package pkg_foo is new my_generic_pkg
generic map (
g_my_generic => 2
);
package foo_pkg is new my_generic_pkg
generic map (
g_my_generic => 2
);

View File

@ -0,0 +1,15 @@
package foo is new my_generic_pkg
generic map (
g_my_generic => 2
);
package pkg_foo is new my_generic_pkg
generic map (
g_my_generic => 2
);
package foo_pkg is new my_generic_pkg
generic map (
g_my_generic => 2
);

View File

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
import os
import unittest
from tests import utils
from vsg import vhdlFile
from vsg.rules import package_instantiation
sTestDir = os.path.dirname(__file__)
lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_600_test_input.vhd"))
class test_package_instantiation_rule(unittest.TestCase):
def setUp(self):
self.oFile = vhdlFile.vhdlFile(lFile)
self.assertIsNone(eError)
def test_rule_600(self):
oRule = package_instantiation.rule_600()
self.assertTrue(oRule)
self.assertEqual(oRule.name, "package_instantiation")
self.assertEqual(oRule.identifier, "600")
lExpected = [2, 7]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

View File

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
import os
import unittest
from tests import utils
from vsg import vhdlFile
from vsg.rules import package_instantiation
sTestDir = os.path.dirname(__file__)
lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_601_test_input.vhd"))
class test_package_instantiation_rule(unittest.TestCase):
def setUp(self):
self.oFile = vhdlFile.vhdlFile(lFile)
self.assertIsNone(eError)
def test_rule_601(self):
oRule = package_instantiation.rule_601()
self.assertTrue(oRule)
self.assertEqual(oRule.name, "package_instantiation")
self.assertEqual(oRule.identifier, "601")
lExpected = [2, 12]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))