Issue#1330 Added tests for new package instantiation naming rules.
This commit is contained in:
parent
b820d1f914
commit
27051dd201
|
|
@ -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
|
||||
);
|
||||
|
|
@ -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
|
||||
);
|
||||
|
|
@ -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))
|
||||
|
|
@ -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))
|
||||
Loading…
Reference in New Issue