Fix `if not disabler()` case

Closes: #6010
pull/6011/head
Xavier Claessens 5 years ago
parent f060a417bc
commit 1930fc82e2
  1. 2
      mesonbuild/interpreterbase.py
  2. 22
      test cases/common/163 disabler/meson.build

@ -500,6 +500,8 @@ class InterpreterBase:
def evaluate_notstatement(self, cur):
v = self.evaluate_statement(cur.value)
if is_disabler(v):
return v
if not isinstance(v, bool):
raise InterpreterException('Argument to "not" is not a boolean.')
return not v

@ -76,3 +76,25 @@ else
has_not_changed = true
endif
assert(has_not_changed, 'App has changed.')
if_is_disabled = true
if disabler()
if_is_disabled = false
else
if_is_disabled = false
endif
assert(if_is_disabled, 'Disabler in "if condition" must skip both blocks')
if not disabler()
if_is_disabled = false
else
if_is_disabled = false
endif
assert(if_is_disabled, 'Disabler in "if not condition" must skip both blocks')
if disabler() == 1
if_is_disabled = false
else
if_is_disabled = false
endif
assert(if_is_disabled, 'Disabler in "if a==b" must skip both blocks')

Loading…
Cancel
Save