aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2023-06-09 17:58:49 -0400
committerDylan Baker <dylan@pnwbakers.com>2023-06-20 16:10:20 -0700
commit6f2956e76c58c49b12298fbf144399c41c380520 (patch)
treee8f41059b9dee8d00f133236572f124851f7f706 /test cases
parentbe20e0809f3cee518a49f4c22ce3ca19319ebb33 (diff)
downloadmeson-6f2956e76c58c49b12298fbf144399c41c380520.zip
meson-6f2956e76c58c49b12298fbf144399c41c380520.tar.gz
meson-6f2956e76c58c49b12298fbf144399c41c380520.tar.bz2
interpreter: Accept more types in default_options dict values
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/264 default_options dict/lib.c1
-rw-r--r--test cases/common/264 default_options dict/meson.build22
-rw-r--r--test cases/common/264 default_options dict/meson_options.txt4
3 files changed, 27 insertions, 0 deletions
diff --git a/test cases/common/264 default_options dict/lib.c b/test cases/common/264 default_options dict/lib.c
new file mode 100644
index 0000000..3ef78ee
--- /dev/null
+++ b/test cases/common/264 default_options dict/lib.c
@@ -0,0 +1 @@
+#warning Make sure this is not fatal
diff --git a/test cases/common/264 default_options dict/meson.build b/test cases/common/264 default_options dict/meson.build
new file mode 100644
index 0000000..06edd7b
--- /dev/null
+++ b/test cases/common/264 default_options dict/meson.build
@@ -0,0 +1,22 @@
+project('test default options', 'c',
+ default_options: {
+ 'bool': true,
+ 'int': 42,
+ 'str': 'foo',
+ 'array': ['foo'],
+ 'werror': true,
+ },
+)
+
+assert(get_option('bool') == true)
+assert(get_option('int') == 42)
+assert(get_option('str') == 'foo')
+assert(get_option('array') == ['foo'])
+assert(get_option('werror') == true)
+
+cc = meson.get_compiler('c')
+
+# MSVC does not support #warning
+if cc.get_id() != 'msvc'
+ static_library('foo', 'lib.c', override_options: {'werror': false})
+endif
diff --git a/test cases/common/264 default_options dict/meson_options.txt b/test cases/common/264 default_options dict/meson_options.txt
new file mode 100644
index 0000000..1b0b0e1
--- /dev/null
+++ b/test cases/common/264 default_options dict/meson_options.txt
@@ -0,0 +1,4 @@
+option('bool', type: 'boolean', value: false)
+option('int', type: 'integer', value: 0)
+option('str', type: 'string', value: 'bar')
+option('array', type: 'array', value: ['bar'])