Commit 6d35101f authored by Mathieu Giraud's avatar Mathieu Giraud

src/should.py: 'w' modifier together with 'r'

parent 9569d6f2
Pipeline #735 passed with stages
in 1 second
......@@ -83,6 +83,9 @@ class TestLine():
>>> TestLine('w2', 'o').test(['hello world'])
True
>>> TestLine('wr2', 'a.c').test(['bli abc axc bla'])
True
>>> print(TestLine('x3y', 'hello'))
xy3:hello
......@@ -117,7 +120,9 @@ class TestLine():
self.count = 0
for l in lines:
if self.regex:
if self.regex.search(l):
if self.mods.count_all:
self.count += len(self.regex.findall(l))
elif self.regex.search(l):
self.count += 1
elif self.expression in l:
self.count += l.count(self.expression) if self.mods.count_all else 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment