Debian Codegraph @

vendored-meson/meson/test cases/common/40 options/meson.build

raw
1 # SPDX-License-Identifier: Apache-2.0
2 # Copyright © 2025 Intel Corporation
3
4 project('options', meson_version : '>= 1.0.0')
5
6 # This must happen before any language is added, or we wont be sure that the
7 # compiler didn't cause b_lto to be initialized
8 assert(get_option('b_lto') == false, 'Unused b_ option does not have default value')
9
10 add_languages('c', required : true)
11
12 if get_option('testoption') != 'optval'
13 error('Incorrect value to test option')
14 endif
15
16 if get_option('other_one') != false
17 error('Incorrect value to boolean option.')
18 endif
19
20 if get_option('combo_opt') != 'combo'
21 error('Incorrect value to combo option.')
22 endif
23
24 if get_option('array_opt') != ['one', 'two']
25 message(get_option('array_opt'))
26 error('Incorrect value for array option')
27 endif
28
29 # If the default changes, update test cases/unit/13 reconfigure
30 if get_option('b_pch') != true
31 error('Incorrect value in base option.')
32 endif
33
34 if get_option('includedir') != 'include'
35 error('Incorrect value in builtin option.')
36 endif
37
38 if get_option('integer_opt') != 3
39 error('Incorrect value in integer option.')
40 endif
41
42 negint = get_option('neg_int_opt')
43 if negint not in [-2, -3, -10]
44 error('Incorrect value @0@ in negative integer option.'.format(negint))
45 endif
46
47 if get_option('CaseSenSiTivE') != 'Some CAPS'
48 error('Incorrect value in mixed caps option.')
49 endif
50
51 if get_option('CASESENSITIVE') != 'ALL CAPS'
52 error('Incorrect value in all caps option.')
53 endif
54
55 assert(get_option('wrap_mode') == 'default', 'Wrap mode option is broken.')
56 assert(get_option('boolean_string') == false)
57 assert(get_option('boolean_string2') == true)
58 assert(get_option('integer_string') == 42)
59
60 testcase expect_error('Invalid option name \'..invalid\'')
61 get_option('..invalid')
62 endtestcase
63
64 testcase expect_error('Invalid option name \'this.is.also.invalid\'')
65 get_option('this.is.also.invalid')
66 endtestcase