Commit 9fa1477a authored by Mathieu Giraud's avatar Mathieu Giraud

Merge branch 'feature/43-command-line-priority' into 'dev'

Feature/43 command line priority

Closes #43

See merge request !15
parents f053e9ec 939df4e1
Pipeline #71757 passed with stages
in 13 seconds
!OPTIONS: --mod w
# Modifiers given through the !OPTIONS line apply to every test.
LC_ALL=C cal 2001
# Here tests with `w` count all occurrences, even when they are on the same line.
LC_ALL=C cal 2001
$ 7 months have 31 days
w7: 31
# Uppercase modifiers cancel previous modifiers
$ 5 lines have a '31' day
wW5: 31
# Here tests with `w` count all occurrences, even when they are on the same line.
# Modifiers given through the command line or through !OPTIONS apply to every test.
!OPTIONS: --mod w
LC_ALL=C cal 2001
$ 7 months have 31 days
7: 31
......@@ -14,9 +23,5 @@ $ 7 months have 31 days
$ 11 months have 30 days or more
11: 30
# Uppercase modifiers cancel previous modifiersrs.
$ 5 lines have a '31' day
W5: 31
$ 7 months have a '31' day (W is here overriden by --mod w)
W7: 31
......@@ -703,6 +703,7 @@ class TestSuite():
self.skip = False
self.status = None
self.modifiers = modifiers
self.opt_modifiers = ''
self.variables = []
self.status = None
self.stats = Stats('test')
......@@ -779,8 +780,7 @@ class TestSuite():
opts, unknown = options.parse_known_args(l[len(DIRECTIVE_OPTIONS):].split())
self.variables = populate_variables(opts.var) + self.variables
self.variables_all = self.variables + variables
if opts.mod:
self.modifiers += ''.join(opts.mod)
self.opt_modifiers = ''.join(opts.mod) if opts.mod else ''
continue
# Directive -- Exit code
......@@ -806,7 +806,7 @@ class TestSuite():
if RE_TEST.search(l):
pos = l.find(TOKEN_TEST)
modifiers, expression = l[:pos], l[pos+1:]
test = TestCase(self.modifiers + modifiers, expression, name)
test = TestCase(modifiers + self.opt_modifiers + self.modifiers, expression, name)
current_tests.append(test)
self.tests.append(test)
continue
......@@ -1144,7 +1144,7 @@ if __name__ == '__main__':
)
if args.fail_a:
args.mod += ['A']
args.mod = (args.mod if args.mod else []) + ['A']
# Launch tests
fs = FileSet(args.file, timeout = args.timeout, modifiers=''.join(args.mod if args.mod else []))
......
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