Debian Codegraph @

test cases/common/266 format string/meson.build

raw
1 project('test format string')
2
3 # Test all supported types in message(), format(), f-string.
4 foreach t : [get_option('opt'), 42, true, false, 'str', ['list'], {'dict': 'value'}]
5 message(t, '@0@'.format(t), f'@t@', [t], {'key': t})
6 endforeach
7
8 # Deprecated but should work with str.format().
9 env = environment()
10 message('@0@'.format(env))
11
12 # Should fail with f-string and message()
13 error_msg = 'Value other than strings, integers, bools, options, dictionaries and lists thereof.'
14 testcase expect_error('message(): ' + error_msg)
15 message(env)
16 endtestcase
17
18 testcase expect_error('f-string: ' + error_msg)
19 message(f'@env@')
20 endtestcase