From 86f27ac241c2366022c55e891e449a2ed08b308a Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Thu, 27 Sep 2018 13:08:02 -0400 Subject: Added unit tests for creating macros using unicode digits in the arguments --- tests/test_cmd2.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests') 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') -- cgit v1.2.1