From 2c3503e7528dbeaaafac0097ef771d2701b959d7 Mon Sep 17 00:00:00 2001 From: Peter Evans Date: Sun, 7 Jan 2018 15:48:43 -0600 Subject: [PATCH] Clarify test conditions; allow docblock on line above --- tools/inspect-c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/inspect-c b/tools/inspect-c index aa64a5f..9d373d7 100755 --- a/tools/inspect-c +++ b/tools/inspect-c @@ -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()