summaryrefslogtreecommitdiff
path: root/tests/test_cmd2.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2018-09-27 13:08:02 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2018-09-27 13:08:02 -0400
commit86f27ac241c2366022c55e891e449a2ed08b308a (patch)
tree6417ef5f698203e099ca2312e8f57a449b3f3305 /tests/test_cmd2.py
parent5ab1ab67f8a5814f342053b7b2430d49822a3ead (diff)
downloadcmd2-git-86f27ac241c2366022c55e891e449a2ed08b308a.tar.gz
Added unit tests for creating macros using unicode digits in the arguments
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r--tests/test_cmd2.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index 8a56bad3..5b8fedaa 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -2001,6 +2001,21 @@ def test_macro_create_with_wrong_arg_count(base_app, capsys):
out, err = capsys.readouterr()
assert "expects 2 argument(s)" in err
+def test_macro_create_with_unicode_numbered_arg(base_app, capsys):
+ # Create the macro expecting 1 argument
+ out = run_cmd(base_app, 'macro create fake help {\N{ARABIC-INDIC DIGIT ONE}}')
+ assert out == normalize("Macro 'fake' created")
+
+ # Run the macro
+ out = run_cmd(base_app, 'fake')
+ out, err = capsys.readouterr()
+ assert "expects 1 argument(s)" in err
+
+def test_macro_create_with_missing_unicode_arg_nums(base_app, capsys):
+ run_cmd(base_app, 'macro create fake help {1} {\N{ARABIC-INDIC DIGIT THREE}}')
+ out, err = capsys.readouterr()
+ assert "Not all numbers between 1 and 3" in err
+
def test_macro_list_invalid_macro(base_app, capsys):
# Look up invalid macro
run_cmd(base_app, 'macro list invalid')