diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-05-13 13:17:29 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-05-13 13:17:29 -0400 |
commit | 1ecaddf29994a1b4f04160a50687676cefa820e4 (patch) | |
tree | 04f7c7504a64b858210b3032e005d3466eace852 /tests/test_cmd2.py | |
parent | 94583078ce4018b6abe0dc2898958fee1acf96e3 (diff) | |
download | cmd2-git-1ecaddf29994a1b4f04160a50687676cefa820e4.tar.gz |
Added unit test
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r-- | tests/test_cmd2.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 24161d76..7a17cfac 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -576,6 +576,21 @@ def test_pipe_to_shell(base_app): out, err = run_cmd(base_app, command) assert out and not err +def test_pipe_to_shell_and_redirect(base_app): + filename = 'out.txt' + if sys.platform == "win32": + # Windows + command = 'help | sort > {}'.format(filename) + else: + # Mac and Linux + # Get help on help and pipe it's output to the input of the word count shell command + command = 'help help | wc > {}'.format(filename) + + out, err = run_cmd(base_app, command) + assert not out and not err + assert os.path.exists(filename) + os.remove(filename) + def test_pipe_to_shell_error(base_app): # Try to pipe command output to a shell command that doesn't exist in order to produce an error out, err = run_cmd(base_app, 'help | foobarbaz.this_does_not_exist') |