bin
doc
examples
files
lib
python
t
CMDTEST_as_module.py
CMDTEST_exit_nonzero.py
CMDTEST_exit_zero.py
CMDTEST_stdout_equal.py
as_module.py
selftest_utils.py
CMDTEST_example.py
Rakefile
cmdtest.py
src
t
.gitignore
.hgignore
CMDTEST_example.yml
COPYING.txt
README.html
README.rst
Rakefile
cmdtest.gemspec
file1.txt
file2.txt
run-regression.rb
setup.rb
43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
|
|
from selftest_utils import SelftestUtils
|
|
|
|
class TC_exit_nonzero(SelftestUtils, TestCase):
|
|
|
|
def test_exit_nonzero_CORRECT(self):
|
|
self.create_CMDTEST_foo(
|
|
'with self.cmd("false") as c:',
|
|
' c.exit_nonzero()',
|
|
)
|
|
|
|
with self.cmd_cmdtest() as c:
|
|
c.stdout_equal([
|
|
"### cmdline: false",
|
|
])
|
|
|
|
def test_exit_nonzero_INCORRECT(self):
|
|
self.create_CMDTEST_foo(
|
|
'with self.cmd("true") as c:',
|
|
' c.exit_nonzero()',
|
|
)
|
|
|
|
with self.cmd_cmdtest() as c:
|
|
c.stdout_equal([
|
|
"### cmdline: true",
|
|
"--- ERROR: exit_nonzero",
|
|
"actual: 0",
|
|
"expect: <nonzero value>",
|
|
"",
|
|
])
|
|
c.exit_nonzero()
|
|
|
|
def test_exit_nonzero_CORRECT_18(self):
|
|
self.create_CMDTEST_foo(
|
|
'with self.cmd("exit 18") as c:',
|
|
' c.exit_nonzero()',
|
|
)
|
|
|
|
with self.cmd_cmdtest() as c:
|
|
c.stdout_equal([
|
|
"### cmdline: exit 18",
|
|
])
|