Updates for issue #384:

Fixing issue where VSG was classifying <= in an assert statement.

  1)  Added tests to show the issue
  2)  Updated code to address the issue
This commit is contained in:
Jeremiah Leary 2020-05-07 21:38:11 -05:00
parent a3a3c68721
commit 09b7a9666b
3 changed files with 30 additions and 4 deletions

View File

@ -20,4 +20,13 @@ begin
report "Something"
severity FAILURE;
PROC : process (CLK) is
begin
assert 3 <= 7
report "something";
end process PROC;
end architecture ARCH;

View File

@ -10,7 +10,7 @@ oFile = vhdlFile.vhdlFile(lFile)
class testVhdlFileMethods(unittest.TestCase):
def test_isAssertKeyword_assignment(self):
lExpected = [6,10,15,19]
lExpected = [6,10,15,19,26]
# Generic actual list
lActual = []
for iIndex, oLine in enumerate(oFile.lines):
@ -20,7 +20,7 @@ class testVhdlFileMethods(unittest.TestCase):
self.assertEqual(lActual, lExpected)
def test_isAssertEnd_assignment(self):
lExpected = [8,12,17,21]
lExpected = [8,12,17,21,27]
# Generic actual list
lActual = []
for iIndex, oLine in enumerate(oFile.lines):
@ -30,7 +30,7 @@ class testVhdlFileMethods(unittest.TestCase):
self.assertEqual(lActual, lExpected)
def test_insideAssert_assignment(self):
lExpected = [6,7,8,10,11,12,15,16,17,19,20,21]
lExpected = [6,7,8,10,11,12,15,16,17,19,20,21,26,27]
# Generic actual list
lActual = []
for iIndex, oLine in enumerate(oFile.lines):
@ -38,3 +38,20 @@ class testVhdlFileMethods(unittest.TestCase):
lActual.append(iIndex)
# Compare
self.assertEqual(lActual, lExpected)
def test_indent(self):
lExpected = [None,1,1,None,2,3,None,1,None]
lActual = []
for iIndex, oLine in enumerate(oFile.lines):
if iIndex > 21 and iIndex < 31:
lActual.append(oLine.indentLevel)
self.assertEqual(lActual, lExpected)
def test_sequential(self):
lExpected = []
lActual = []
for iIndex, oLine in enumerate(oFile.lines):
if oLine.insideSequential:
lActual.append(iIndex)
# Compare
self.assertEqual(lActual, lExpected)

View File

@ -5,7 +5,7 @@ def sequential(dVars, oLine):
if not (oLine.insideProcess or oLine.insideProcedure):
return
if re.match('^.*<=', oLine.line) and not oLine.isComment and not oLine.insideIf and not oLine.isElseKeyword and not oLine.insideCaseWhen:
if re.match('^.*<=', oLine.line) and not oLine.isComment and not oLine.insideIf and not oLine.isElseKeyword and not oLine.insideCaseWhen and not oLine.insideAssert:
oLine.isSequential = True
oLine.insideSequential = True
oLine.indentLevel = dVars['iCurrentIndentLevel']