summaryrefslogtreecommitdiff
path: root/tests/test_argparse.py
diff options
context:
space:
mode:
authorkotfu <kotfu@kotfu.net>2018-05-03 10:43:49 -0700
committerkotfu <kotfu@kotfu.net>2018-05-03 10:49:20 -0700
commit6d2f520b5a5a7165f2406816592b01983b1feb26 (patch)
treecb30ffca0f7abc68e43cfaf039148be11c315784 /tests/test_argparse.py
parentc539ef4065e9ae8611e1851eaa740f6412f08c25 (diff)
downloadcmd2-git-6d2f520b5a5a7165f2406816592b01983b1feb26.tar.gz
Moved some argparse tests from test_transcript.py to test_argparse.py
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']