Commit bfe8517c authored by Mathieu Giraud's avatar Mathieu Giraud

src/should.py: test() also returns self.status

This eases doctests.
parent 8866fa72
......@@ -28,11 +28,12 @@ class TestLine():
:hello
>>> test.test(['world'])
False
>>> test.status
False
>>> test.test(['hello'])
>>> test.status
True
......@@ -41,11 +42,9 @@ class TestLine():
3:hello
>>> test.test(['hello'])
>>> test.status
False
>>> test.test(['hello'] * 3)
>>> test.status
True
......@@ -80,6 +79,7 @@ class TestLine():
count += 1
self.status = (count > 0) if self.expected_count is None else (count == self.expected_count)
return self.status
def __str__(self):
s = ''
......@@ -106,6 +106,7 @@ class TestSet():
>>> s.test()
echo "hello"
True
>>> s.tests[0].status
True
'''
......@@ -159,6 +160,8 @@ class TestSet():
if not test.status:
self.status = False
return self.status
def __str__(self):
s = ''
s += '\n'.join(self.cmds)
......
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