add native-file properties tests

pull/6161/head
Michael Hirsch, Ph.D 5 years ago
parent c2e6565029
commit 6c963726cf
No known key found for this signature in database
GPG Key ID: 6D23CDADAB0294F9
  1. 4
      docs/markdown/Reference-manual.md
  2. 10
      test cases/common/192 args flattening/meson.build
  3. 10
      test cases/common/228 native prop/meson.build
  4. 3
      test cases/common/228 native prop/nativefile.ini
  5. 3
      test cases/failing/97 no native prop/meson.build

@ -1786,6 +1786,10 @@ the following methods.
returns the "cross" compiler if we're currently cross-compiling and
the "native" compiler if we're not.
- `get_native_property(propname, fallback_value)` returns the given
property from a native file, the optional second argument is returned
if the given property is not found.
- `has_exe_wrapper()` returns true when doing a cross build if there
is a wrapper command that can be used to execute cross built
binaries (for example when cross compiling from Linux to Windows,

@ -1,29 +1,25 @@
project('args flattening')
arr = get_variable('does-not-exist', ['bar', 'baz'])
assert(arr == ['bar', 'baz'], 'get_variable with array fallback is broken')
set_variable('arr', ['bar', 'baz'])
assert(arr == ['bar', 'baz'], 'set_variable(array) is broken')
conf = configuration_data()
conf.set('foo', ['bar', 'baz'])
assert(conf.get('foo') == ['bar', 'baz'], 'configuration_data.set(array) is broken')
arr = conf.get('does-not-exist', ['bar', 'baz'])
assert(arr == ['bar', 'baz'], 'configuration_data.get with array fallback is broken')
arr = meson.get_cross_property('does-not-exist', ['bar', 'baz'])
assert(arr == ['bar', 'baz'], 'meson.get_cross_property with array fallback is broken')
arr = meson.get_native_property('does-not-exist', ['bar', 'baz'])
assert(arr == ['bar', 'baz'], 'meson.get_native_property with array fallback is broken')
# Test deprecated behaviour
conf.set(['foo', 'bar'])
message(conf.get('foo'))

@ -0,0 +1,10 @@
project('get native prop')
x = meson.get_native_property('astring')
assert(x=='mystring', 'did not get native property string. did you use "meson setup --native-file native.txt"')
x = meson.get_native_property('notexist', 'fallback')
assert(x=='fallback', 'fallback did not work')
x = meson.get_native_property('anarray')
assert(x==['one', 'two'], 'array did not work')

@ -0,0 +1,3 @@
[properties]
astring = 'mystring'
anarray = ['one', 'two']

@ -0,0 +1,3 @@
project('missing native property')
message(meson.get_native_property('nonexisting'))
Loading…
Cancel
Save