diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2021-02-25 11:29:55 +0000 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2021-02-26 10:15:17 -0500 |
commit | ace22f21a7f0abe9250e673a258e4adf3afa4ac0 (patch) | |
tree | 51ed52296025fc51125e41acabe2eb74d8dd5cc3 /test cases/common | |
parent | c5aee36fa244287d1a840953a62dc2727037952c (diff) | |
download | meson-ace22f21a7f0abe9250e673a258e4adf3afa4ac0.zip meson-ace22f21a7f0abe9250e673a258e4adf3afa4ac0.tar.gz meson-ace22f21a7f0abe9250e673a258e4adf3afa4ac0.tar.bz2 |
meson: add .has_external_property() methods
Useful in case of boolean values to distinguish between a boolean
value having been set in the native/cross file and not having been
provided, which can't be achieved by passing a fallback parameter
to .get_external_property().
Diffstat (limited to 'test cases/common')
-rw-r--r-- | test cases/common/223 native prop/crossfile.ini | 3 | ||||
-rw-r--r-- | test cases/common/223 native prop/meson.build | 26 |
2 files changed, 27 insertions, 2 deletions
diff --git a/test cases/common/223 native prop/crossfile.ini b/test cases/common/223 native prop/crossfile.ini index 62d63ed..13deef3 100644 --- a/test cases/common/223 native prop/crossfile.ini +++ b/test cases/common/223 native prop/crossfile.ini @@ -1,3 +1,4 @@ [properties] astring = 'cross' -anarray = ['one', 'two']
\ No newline at end of file +anarray = ['one', 'two'] +red = true diff --git a/test cases/common/223 native prop/meson.build b/test cases/common/223 native prop/meson.build index 64da410..8752371 100644 --- a/test cases/common/223 native prop/meson.build +++ b/test cases/common/223 native prop/meson.build @@ -22,4 +22,28 @@ assert(x=='fallback', 'fallback native:false did not work') x = meson.get_external_property('anarray') -assert(x==['one', 'two'], 'array did not work')
\ No newline at end of file +assert(x==['one', 'two'], 'array did not work') + +assert(meson.has_external_property('anarray'), 'expected property "anarray" to exist') +assert(meson.has_external_property('astring'), 'expected property "astring" to exist') +assert(not meson.has_external_property('abool'), 'did not expect property "abool" to exist') + +# These exist in both +assert(meson.has_external_property('anarray', native: false), 'FIXME') +assert(meson.has_external_property('anarray', native: true), 'FIXME') +assert(meson.has_external_property('astring', native: false), 'FIXME') +assert(meson.has_external_property('astring', native: true), 'FIXME') + +if meson.is_cross_build() + # This property only exists in the cross file + assert(meson.has_external_property('red'), 'expected property "red" to exist in cross file') + assert(meson.has_external_property('red', native: false), 'expected property "red" to exist in cross file') + assert(not meson.has_external_property('red', native: true), 'did not expect property "red" to exist in native file') + + assert(not meson.has_external_property('abool', native: false), 'FIXME') + assert(not meson.has_external_property('abool', native: false), 'FIXME') +else + assert(not meson.has_external_property('red'), 'did not expect property "red" to exist in native file') + assert(not meson.has_external_property('red', native: false), 'did not expect property "red" to exist in cross file because we are not doing a cross build') + assert(not meson.has_external_property('red', native: true), 'did not expect property "red" to exist in native file') +endif |