summaryrefslogtreecommitdiff
path: root/tests/test_argparse.py
diff options
context:
space:
mode:
authorEric Lin <anselor@gmail.com>2018-05-16 10:39:49 -0400
committerEric Lin <anselor@gmail.com>2018-05-16 10:39:49 -0400
commit371284d20370a8e85dd8527d9bbcc6267b335cde (patch)
tree002ac709eca15522a0b1abaa235aae04975b08e6 /tests/test_argparse.py
parentab8194e92b9c3728d8f86cb9c81de180b6884eee (diff)
parenta9b712108e5af49937b0af3aa51db2ebe5c159e4 (diff)
downloadcmd2-git-371284d20370a8e85dd8527d9bbcc6267b335cde.tar.gz
Merge branch 'master' into pyscript
Diffstat (limited to 'tests/test_argparse.py')
-rw-r--r--tests/test_argparse.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_argparse.py b/tests/test_argparse.py
index 94a7b5ed..f1a2b357 100644
--- a/tests/test_argparse.py
+++ b/tests/test_argparse.py
@@ -119,6 +119,11 @@ def argparse_app():
return app
+def test_invalid_syntax(argparse_app, capsys):
+ run_cmd(argparse_app, 'speak "')
+ out, err = capsys.readouterr()
+ assert err == "ERROR: Invalid syntax: No closing quotation\n"
+
def test_argparse_basic_command(argparse_app):
out = run_cmd(argparse_app, 'say hello')
assert out == ['hello']
@@ -135,6 +140,14 @@ def test_argparse_with_list_and_empty_doc(argparse_app):
out = run_cmd(argparse_app, 'speak -s hello world!')
assert out == ['HELLO WORLD!']
+def test_argparse_comment_stripping(argparse_app):
+ out = run_cmd(argparse_app, 'speak it was /* not */ delicious! # Yuck!')
+ assert out == ['it was delicious!']
+
+def test_argparser_correct_args_with_quotes_and_midline_options(argparse_app):
+ out = run_cmd(argparse_app, "speak 'This is a' -s test of the emergency broadcast system!")
+ assert out == ['THIS IS A TEST OF THE EMERGENCY BROADCAST SYSTEM!']
+
def test_argparse_quoted_arguments_multiple(argparse_app):
out = run_cmd(argparse_app, 'say "hello there" "rick & morty"')
assert out == ['hello there rick & morty']