summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2017-07-03 19:56:25 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2017-07-03 19:56:25 -0400
commit7c17d8bbf006e17f0104b6d9d35fc67ca4f235fd (patch)
treeb6112be31428ad363c74a420cda5a70d2bd7f5ac /tests
parentd092e61815f9132b7acd3859563c143ac8ddda56 (diff)
downloadcmd2-git-7c17d8bbf006e17f0104b6d9d35fc67ca4f235fd.tar.gz
Fixed a few bugs and examples
Bug fixes: - case_insensitive is no longer a runtime-settable parameter, but it was still listed as such - Fixed a recursive loop bug when abbreviated commands are enabled and it could get stuck in the editor forever - Added additional command abbreviations to the "exclude from history" list - Fixed argparse_example.py and pirate.py examples Other changes: - Organized all attributes used to configure the ParserManager into a single location - Set the default value of "abbrev" to False (which controls whether or not abbreviated commands are allowed) - With good tab-completion of command names, using abbreviated commands isn't a particularly useful feature - And it can create problems
Diffstat (limited to 'tests')
-rw-r--r--tests/conftest.py6
-rw-r--r--tests/test_cmd2.py4
-rw-r--r--tests/test_transcript.py1
-rw-r--r--tests/transcript_regex.txt1
4 files changed, 5 insertions, 7 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 69001e42..b4d8c804 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -47,9 +47,8 @@ expect_colors = True
if sys.platform.startswith('win'):
expect_colors = False
# Output from the show command with default settings
-SHOW_TXT = """abbrev: True
+SHOW_TXT = """abbrev: False
autorun_on_edit: False
-case_insensitive: True
colors: {}
continuation_prompt: >
debug: False
@@ -67,9 +66,8 @@ if expect_colors:
else:
color_str = 'False'
SHOW_LONG = """
-abbrev: True # Accept abbreviated commands
+abbrev: False # Accept abbreviated commands
autorun_on_edit: False # Automatically run files after editing
-case_insensitive: True # Upper- and lower-case both OK
colors: {} # Colorized output (*nix only)
continuation_prompt: > # On 2nd+ line of input
debug: False # Show full error stack on error
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index 5499ffea..68a59c01 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -99,7 +99,7 @@ To enable full traceback, run the following command: 'set debug true'
""")
assert normalize(str(err)) == expected
-def test_set_abbreviated(base_app):
+def test_set_quiet(base_app):
out = run_cmd(base_app, 'set quie True')
expected = normalize("""
quiet - was: False
@@ -649,7 +649,7 @@ def test_edit_no_editor(base_app, capsys):
base_app.editor = None
# Make sure we get an exception, but cmd2 handles it
- run_cmd(base_app, 'ed')
+ run_cmd(base_app, 'edit')
out, err = capsys.readouterr()
expected = _expected_no_editor_error()
diff --git a/tests/test_transcript.py b/tests/test_transcript.py
index 4ffcd162..bc116e9a 100644
--- a/tests/test_transcript.py
+++ b/tests/test_transcript.py
@@ -21,6 +21,7 @@ from conftest import run_cmd, StdOut, normalize
class CmdLineApp(Cmd):
def __init__(self, *args, **kwargs):
+ self.abbrev = True
self.multilineCommands = ['orate']
self.maxrepeats = 3
self.redirector = '->'
diff --git a/tests/transcript_regex.txt b/tests/transcript_regex.txt
index 4cddad2c..47357284 100644
--- a/tests/transcript_regex.txt
+++ b/tests/transcript_regex.txt
@@ -3,7 +3,6 @@
(Cmd) set
abbrev: True
autorun_on_edit: False
-case_insensitive: True
colors: /(True|False)/
continuation_prompt: >
debug: False