Commit 28eaf5a6 authored by Mikaël Salson's avatar Mikaël Salson

Merge branch 'feature/30-no-extra' into 'dev'

Feature/30 no extra

Closes #30

See merge request !6
parents 2a21dfd9 323dbf2e
Pipeline #65863 passed with stages
in 10 seconds
# The --extra option allows to add something after the first word every command.
./should -v --extra You demo/hello.should ; true
$ 'You' is added right after 'echo'
: echo You hello, world
./should -v --extra They demo/no.should ; true
$ 'They' is not added because of NO_EXTRA
0: echo They hello, world
\ No newline at end of file
# A !NO_EXTRA directive tell to ignore any --extra arguments.
# See demo/extra.should
!NO_EXTRA:
echo hello, world
$ No extra arguments were given to `echo`
r1:^hello, world$
......@@ -57,6 +57,7 @@ RE_TEST = re.compile('^(\S)*[:]')
DIRECTIVE_REQUIRES = '!REQUIRES:'
DIRECTIVE_NO_LAUNCHER = '!NO_LAUNCHER:'
DIRECTIVE_SCRIPT = '!LAUNCH:'
DIRECTIVE_NO_EXTRA = '!NO_EXTRA:'
DIRECTIVE_OPTIONS = '!OPTIONS:'
DIRECTIVE_SOURCE = '!OUTPUT_FILE:'
DIRECTIVE_EXIT_CODE = '!EXIT_CODE:'
......@@ -676,6 +677,11 @@ class TestSuite():
self.use_launcher = False
continue
# Directive -- No extra options
if l.startswith(DIRECTIVE_NO_EXTRA):
self.variables = [(VAR_EXTRA, '')] + self.variables
continue
# Directive -- Source
if l.startswith(DIRECTIVE_SOURCE):
self.source = os.path.join(self.cd if self.cd else '', l[len(DIRECTIVE_SOURCE):].strip())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment