diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-09-29 10:07:29 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2017-11-29 14:14:41 -0800 |
commit | c9351ce30c03d107279090da7825096951a705d3 (patch) | |
tree | a9bf94236755986b2f69d2ef297e339c3c898561 /test cases | |
parent | 7c779a76df9b8a4dd466b120f817b50f857081fa (diff) | |
download | meson-c9351ce30c03d107279090da7825096951a705d3.zip meson-c9351ce30c03d107279090da7825096951a705d3.tar.gz meson-c9351ce30c03d107279090da7825096951a705d3.tar.bz2 |
Add new array type option
This exposes the already existing UserStringArrayOption class through
the meson_options.txt. The intention is to provide a way for projects to
take list/array type arguments and validate that all of the elements in
that array are valid without using complex looping constructrs.
Diffstat (limited to 'test cases')
-rw-r--r-- | test cases/common/166 array option/meson.build | 17 | ||||
-rw-r--r-- | test cases/common/166 array option/meson_options.txt | 19 | ||||
-rw-r--r-- | test cases/common/47 options/meson.build | 5 | ||||
-rw-r--r-- | test cases/common/47 options/meson_options.txt | 1 | ||||
-rw-r--r-- | test cases/unit/18 array option/meson.build | 15 | ||||
-rw-r--r-- | test cases/unit/18 array option/meson_options.txt | 20 |
6 files changed, 77 insertions, 0 deletions
diff --git a/test cases/common/166 array option/meson.build b/test cases/common/166 array option/meson.build new file mode 100644 index 0000000..bfcde7c --- /dev/null +++ b/test cases/common/166 array option/meson.build @@ -0,0 +1,17 @@ +# Copyright © 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +project('stringarray default options') + +assert(get_option('array') == ['foo', 'bar'], 'Default value for array is not equal to choices') diff --git a/test cases/common/166 array option/meson_options.txt b/test cases/common/166 array option/meson_options.txt new file mode 100644 index 0000000..7ed0ac1 --- /dev/null +++ b/test cases/common/166 array option/meson_options.txt @@ -0,0 +1,19 @@ +# Copyright © 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +option( + 'array', + type : 'array', + choices : ['foo', 'bar'], +) diff --git a/test cases/common/47 options/meson.build b/test cases/common/47 options/meson.build index 2a764f0..863703c 100644 --- a/test cases/common/47 options/meson.build +++ b/test cases/common/47 options/meson.build @@ -12,6 +12,11 @@ if get_option('combo_opt') != 'combo' error('Incorrect value to combo option.') endif +if get_option('array_opt') != ['one', 'two'] + message(get_option('array_opt')) + error('Incorrect value for array option') +endif + # If the default changes, update test cases/unit/13 reconfigure if get_option('b_lto') != false error('Incorrect value in base option.') diff --git a/test cases/common/47 options/meson_options.txt b/test cases/common/47 options/meson_options.txt index 653dd75..8978d44 100644 --- a/test cases/common/47 options/meson_options.txt +++ b/test cases/common/47 options/meson_options.txt @@ -1,3 +1,4 @@ option('testoption', type : 'string', value : 'optval', description : 'An option to do something') option('other_one', type : 'boolean', value : false) option('combo_opt', type : 'combo', choices : ['one', 'two', 'combo'], value : 'combo') +option('array_opt', type : 'array', choices : ['one', 'two', 'three'], value : ['one', 'two']) diff --git a/test cases/unit/18 array option/meson.build b/test cases/unit/18 array option/meson.build new file mode 100644 index 0000000..2b44181 --- /dev/null +++ b/test cases/unit/18 array option/meson.build @@ -0,0 +1,15 @@ +# Copyright © 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +project('array option test') diff --git a/test cases/unit/18 array option/meson_options.txt b/test cases/unit/18 array option/meson_options.txt new file mode 100644 index 0000000..0ccdcc4 --- /dev/null +++ b/test cases/unit/18 array option/meson_options.txt @@ -0,0 +1,20 @@ +# Copyright © 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +option( + 'list', + type : 'array', + value : ['foo', 'bar'], + choices : ['foo', 'bar', 'oink', 'boink'], +) |