summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2017-07-08 15:02:55 -0400
committerGitHub <noreply@github.com>2017-07-08 15:02:55 -0400
commit770a5681fdcdad2cb1a6d0bca28d8fca0db1006c (patch)
tree4a725eff39442d2531d451d7710957b3bda6daec /tests
parent88fe14caacfd5cfe590692b3e14b5af611458032 (diff)
parentd380c48a6a523d2df659a6e78d50e027ef542122 (diff)
downloadcmd2-git-770a5681fdcdad2cb1a6d0bca28d8fca0db1006c.tar.gz
Merge pull request #180 from python-cmd2/code_owners
Added a CODEOWNERS file to automatically nominate code reviewers for PRs
Diffstat (limited to 'tests')
-rw-r--r--tests/test_cmd2.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index 8d91c8ef..ee8f6c87 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -829,6 +829,26 @@ def test_default_to_shell_unknown(shell_app):
out = run_cmd(shell_app, unknown_command)
assert out == ["*** Unknown syntax: {}".format(unknown_command)]
+def test_default_to_shell_good(capsys):
+ app = cmd2.Cmd()
+ app.default_to_shell = True
+ line = 'ls'
+ statement = app.parser_manager.parsed(line)
+ retval = app._default(statement)
+ assert not retval
+ out, err = capsys.readouterr()
+ assert out == ''
+
+def test_default_to_shell_failure(capsys):
+ app = cmd2.Cmd()
+ app.default_to_shell = True
+ line = 'ls does_not_exist.xyz'
+ statement = app.parser_manager.parsed(line)
+ retval = app._default(statement)
+ assert not retval
+ out, err = capsys.readouterr()
+ assert out == "*** Unknown syntax: {}\n".format(line)
+
def test_ansi_prompt_not_esacped(base_app):
prompt = '(Cmd) '