Skip to content

Commit

Permalink
Fix if not disabler() case
Browse files Browse the repository at this point in the history
  • Loading branch information
xclaesse committed Oct 8, 2019
1 parent f060a41 commit 1930fc8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mesonbuild/interpreterbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ def evaluate_dictstatement(self, cur):

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
Expand Down
22 changes: 22 additions & 0 deletions test cases/common/163 disabler/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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')

0 comments on commit 1930fc8

Please sign in to comment.