aboutsummaryrefslogtreecommitdiffstats
path: root/meson/test cases/common/222 native prop
diff options
context:
space:
mode:
authorAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
committerAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
commitaf1a266670d040d2f4083ff309d732d648afba2a (patch)
tree2fc46203448ddcc6f81546d379abfaeb323575e9 /meson/test cases/common/222 native prop
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/test cases/common/222 native prop')
-rw-r--r--meson/test cases/common/222 native prop/crossfile.ini4
-rw-r--r--meson/test cases/common/222 native prop/meson.build49
-rw-r--r--meson/test cases/common/222 native prop/nativefile.ini3
3 files changed, 56 insertions, 0 deletions
diff --git a/meson/test cases/common/222 native prop/crossfile.ini b/meson/test cases/common/222 native prop/crossfile.ini
new file mode 100644
index 000000000..13deef3de
--- /dev/null
+++ b/meson/test cases/common/222 native prop/crossfile.ini
@@ -0,0 +1,4 @@
+[properties]
+astring = 'cross'
+anarray = ['one', 'two']
+red = true
diff --git a/meson/test cases/common/222 native prop/meson.build b/meson/test cases/common/222 native prop/meson.build
new file mode 100644
index 000000000..87523719e
--- /dev/null
+++ b/meson/test cases/common/222 native prop/meson.build
@@ -0,0 +1,49 @@
+project('get prop')
+
+x = meson.get_external_property('astring')
+ref = meson.is_cross_build() ? 'cross' : 'mystring'
+assert(x==ref, 'did not get native property string. did you use "meson setup --native-file native.txt"')
+
+x = meson.get_external_property('astring', native: true)
+assert(x=='mystring', 'did not get native property with native:true and non-cross build.')
+
+x = meson.get_external_property('astring', 'fallback', native: false)
+assert(x==ref, 'did not get get native property with native:false and non-cross build.')
+
+
+x = meson.get_external_property('notexist', 'fallback')
+assert(x=='fallback', 'fallback did not work')
+
+x = meson.get_external_property('notexist', 'fallback', native: true)
+assert(x=='fallback', 'fallback native:true did not work')
+
+x = meson.get_external_property('notexist', 'fallback', native: false)
+assert(x=='fallback', 'fallback native:false did not work')
+
+
+x = meson.get_external_property('anarray')
+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
diff --git a/meson/test cases/common/222 native prop/nativefile.ini b/meson/test cases/common/222 native prop/nativefile.ini
new file mode 100644
index 000000000..03c1e0397
--- /dev/null
+++ b/meson/test cases/common/222 native prop/nativefile.ini
@@ -0,0 +1,3 @@
+[properties]
+astring = 'mystring'
+anarray = ['one', 'two'] \ No newline at end of file