Debian Codegraph @

test cases/common/108 ternary/meson.build

raw
1 project('ternary operator')
2
3 x = true
4 one = true ? 1 : error('False branch should not be evaluated')
5 two = false ? error('True branch should not be evaluated.') : 2
6 three = '@0@'.format(x ? 'yes' : 'no')
7 four = [x ? '0' : '1']
8
9 assert(one == 1, 'Return value from ternary true is wrong.')
10 assert(two == 2, 'Return value from ternary false is wrong.')
11 assert(three == 'yes', 'Return value for ternary inside method call is wrong.')
12 assert(four == ['0'], 'Return value for ternary inside of list is wrong.')