about summary refs log tree commit diff
path: root/src/etc/htmldocck.py
diff options
context:
space:
mode:
authormitaa <mitaa.ceb@gmail.com>2016-04-22 17:53:15 +0200
committermitaa <mitaa.ceb@gmail.com>2016-04-22 19:10:30 +0200
commit8ab2c20d8c018c310a0c286aeb2622c41ef357a1 (patch)
tree45a3a2cfecca06483b2140a5ea1df3f81a3a3619 /src/etc/htmldocck.py
parenta264f5b7e8df34c4bf7f10d0c6c7f9ab805ee672 (diff)
downloadrust-8ab2c20d8c018c310a0c286aeb2622c41ef357a1.tar.gz
rust-8ab2c20d8c018c310a0c286aeb2622c41ef357a1.zip
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.
Diffstat (limited to 'src/etc/htmldocck.py')
-rw-r--r--src/etc/htmldocck.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/etc/htmldocck.py b/src/etc/htmldocck.py
index 8362c239b65..a930a0d0833 100644
--- a/src/etc/htmldocck.py
+++ b/src/etc/htmldocck.py
@@ -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':