1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-11-27 20:51:17 +00:00

Clarify test conditions; allow docblock on line above

This commit is contained in:
Peter Evans 2018-01-07 15:48:43 -06:00
parent 0fa930b548
commit 2c3503e752

View File

@ -74,11 +74,18 @@ def test_name_from_func(suite, func):
# not. (Which we can determine because there should be a closing comment
# token on the line above the type.)
def has_doc_block(lines, linenum):
return linenum-2 >= 0 and lines[linenum-2] == ' */'
return linenum-2 >= 0 and (lines[linenum-2] == ' */' or lines[linenum-1] == ' */')
# Do we have a test for this function? The fname is the test file, and
# the suite and test are -- well, what they are.
def has_test(fname, suite, test):
# This is a bit of fakery, but inspect-c is not (yet) smart enough
# to know that a macro like `DEFINE_ADDR(xyz)` expands to
# `mos6502_resolve_xyz` and that the test it should associate is
# that. So we skip macro function definitions for now.
if test.isupper():
return True
data = ''
with open(fname, 'r') as f:
data = f.read()