summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_parsing.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/test_parsing.py b/tests/test_parsing.py
index a637bf8d..ba72edd6 100644
--- a/tests/test_parsing.py
+++ b/tests/test_parsing.py
@@ -756,31 +756,37 @@ def test_statement_is_immutable():
statement.raw = 'baz'
-def test_is_valid_command(parser):
+def test_is_valid_command_invalid(parser):
# Empty command
valid, errmsg = parser.is_valid_command('')
assert not valid and 'cannot be an empty string' in errmsg
# Starts with shortcut
- valid, errmsg = parser.is_valid_command('!cmd')
+ valid, errmsg = parser.is_valid_command('!ls')
assert not valid and 'cannot start with a shortcut' in errmsg
# Contains whitespace
- valid, errmsg = parser.is_valid_command(' ')
+ valid, errmsg = parser.is_valid_command('shell ls')
assert not valid and 'cannot contain: whitespace, quotes,' in errmsg
# Contains a quote
- valid, errmsg = parser.is_valid_command('"cmd')
+ valid, errmsg = parser.is_valid_command('"shell"')
assert not valid and 'cannot contain: whitespace, quotes,' in errmsg
# Contains a redirector
- valid, errmsg = parser.is_valid_command('>cmd')
+ valid, errmsg = parser.is_valid_command('>shell')
assert not valid and 'cannot contain: whitespace, quotes,' in errmsg
# Contains a terminator
- valid, errmsg = parser.is_valid_command(';cmd')
+ valid, errmsg = parser.is_valid_command(';shell')
assert not valid and 'cannot contain: whitespace, quotes,' in errmsg
+def test_is_valid_command_valid(parser):
+ # Empty command
+ valid, errmsg = parser.is_valid_command('shell')
+ assert valid
+ assert not errmsg
+
def test_macro_normal_arg_pattern():
# This pattern matches digits surrounded by exactly 1 brace on a side and 1 or more braces on the opposite side