mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Practracker: allow tabs in include lines
This isn't actually something that Tor does, but it's cleaner to do it this way. Part of 29746.
This commit is contained in:
parent
4c09532996
commit
86d3d310f5
@ -16,7 +16,7 @@ def get_include_count(f):
|
||||
"""Get number of #include statements in the file"""
|
||||
include_count = 0
|
||||
for line in f:
|
||||
if re.match(r' *# *include', line):
|
||||
if re.match(r'\s*#\s*include', line):
|
||||
include_count += 1
|
||||
return include_count
|
||||
|
||||
|
@ -48,5 +48,15 @@ class TestFunctionLength(unittest.TestCase):
|
||||
for name, lines in metrics.get_function_lines(funcs):
|
||||
self.assertEqual(lines, 4)
|
||||
|
||||
class TestIncludeCount(unittest.TestCase):
|
||||
def test_include_count(self):
|
||||
f = StringIO.StringIO("""
|
||||
# include <abc.h>
|
||||
# include "def.h"
|
||||
#include "ghi.h"
|
||||
\t#\t include "jkl.h"
|
||||
""")
|
||||
self.assertEqual(metrics.get_include_count(f),4)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Loading…
Reference in New Issue
Block a user