Only record the same impl once

Due to inlining it is possible to visit the same module multiple times
during `<Cache as DocFolder>::fold_crate`, so we keep track of the
modules we've already visited.
This commit is contained in:
mitaa
2016-04-22 17:53:15 +02:00
parent a264f5b7e8
commit 8ab2c20d8c
4 changed files with 87 additions and 27 deletions

View File

@@ -342,9 +342,9 @@ def check_tree_text(tree, path, pat, regexp):
return ret
def check_tree_count(tree, path, count):
def get_tree_count(tree, path):
path = normalize_xpath(path)
return len(tree.findall(path)) == count
return len(tree.findall(path))
def stderr(*args):
print(*args, file=sys.stderr)
@@ -393,7 +393,10 @@ def check_command(c, cache):
elif c.cmd == 'count': # count test
if len(c.args) == 3: # @count <path> <pat> <count> = count test
ret = check_tree_count(cache.get_tree(c.args[0]), c.args[1], int(c.args[2]))
expected = int(c.args[2])
found = get_tree_count(cache.get_tree(c.args[0]), c.args[1])
cerr = "Expected {} occurrences but found {}".format(expected, found)
ret = expected == found
else:
raise InvalidCheck('Invalid number of @{} arguments'.format(c.cmd))
elif c.cmd == 'valid-html':