Updates for issue #483:

Fixing rule constant_011 so it checks the correct tokens for case.

  1)  Updated tests to expose issue
  2)  Converter constant_011 to use the same base rule as signal_011
This commit is contained in:
Jeremiah Leary 2020-11-24 12:43:41 -06:00
parent c5712a81fb
commit b7e26e8e0a
5 changed files with 41 additions and 9 deletions

View File

@ -1,16 +1,36 @@
from vsg.rules import token_case
#
#from vsg.rules import token_case
#
#from vsg import token
#
#lTokens = []
#lTokens.append(token.constant_declaration.subtype_indication)
#
#
#class rule_011(token_case):
# '''
# Constant rule 011 checks the constant type has proper case.
# '''
#
# def __init__(self):
# token_case.__init__(self, 'constant', '011', lTokens)
from vsg import token
lTokens = []
lTokens.append(token.constant_declaration.subtype_indication)
from vsg.rules import token_case_subtype_indication
lStartTokens = []
lStartTokens.append(token.constant_declaration.colon)
lEndTokens = []
lEndTokens.append(token.constant_declaration.assignment_operator)
lEndTokens.append(token.constant_declaration.semicolon)
class rule_011(token_case):
class rule_011(token_case_subtype_indication):
'''
Constant rule 011 checks the constant type has proper case.
Checks the constant type has proper case.
'''
def __init__(self):
token_case.__init__(self, 'constant', '011', lTokens)
token_case_subtype_indication.__init__(self, 'constant', '011', lStartTokens, lEndTokens)

View File

@ -7,6 +7,10 @@ architecture RTL of FIFO is
constant c_word : integer := 1024;
constant zeros : std_logic_vector(31 downto 0) := (others => '0');
constant zeros : std_logic_vector(31 downto 0) := (others => '0');
begin
end architecture RTL;

View File

@ -7,6 +7,10 @@ architecture RTL of FIFO is
constant c_word : INTEGER := 1024;
constant zeros : STD_LOGIC_VECTOR(31 downto 0) := (others => '0');
constant zeros : STD_LOGIC_VECTOR(31 downto 0) := (others => '0');
begin
end architecture RTL;

View File

@ -7,6 +7,10 @@ architecture RTL of FIFO is
constant c_word : Integer := 1024;
constant zeros : std_logic_vector(31 downto 0) := (others => '0');
constant zeros : STD_LOGIC_VECTOR(31 downto 0) := (others => '0');
begin
end architecture RTL;

View File

@ -29,7 +29,7 @@ class test_constant_rule(unittest.TestCase):
self.assertEqual(oRule.name, 'constant')
self.assertEqual(oRule.identifier, '011')
lExpected = [6, 8]
lExpected = [6, 8, 12]
oRule.analyze(self.oFile)
self.assertEqual(utils.extract_violation_lines_from_violation_object(oRule.violations), lExpected)
@ -41,7 +41,7 @@ class test_constant_rule(unittest.TestCase):
self.assertEqual(oRule.name, 'constant')
self.assertEqual(oRule.identifier, '011')
lExpected = [4, 8]
lExpected = [4, 8, 10]
oRule.analyze(self.oFile)
self.assertEqual(utils.extract_violation_lines_from_violation_object(oRule.violations), lExpected)