summaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2021-06-22 21:26:38 +0300
committerGitHub <noreply@github.com>2021-06-22 21:26:38 +0300
commit39f25ec6aa24b84cb787fc652de019b9292e32aa (patch)
treede11d90fadc276ca23cb7a628503e4db6114758b /test cases
parent765aff5a42d9b7568bbd89f711d52c2da346e91c (diff)
parent0358445b6e02c6adbc5edd841168f90a20430ce3 (diff)
downloadmeson-39f25ec6aa24b84cb787fc652de019b9292e32aa.tar.gz
Merge pull request #8905 from mensinda/refactorFix
fix: Fix set_variable not holderifying (fixes #8904)
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/242 set and get variable/meson.build63
-rw-r--r--test cases/common/242 set and get variable/test1.txt0
-rw-r--r--test cases/common/242 set and get variable/test2.txt0
3 files changed, 63 insertions, 0 deletions
diff --git a/test cases/common/242 set and get variable/meson.build b/test cases/common/242 set and get variable/meson.build
new file mode 100644
index 000000000..6023e88b0
--- /dev/null
+++ b/test cases/common/242 set and get variable/meson.build
@@ -0,0 +1,63 @@
+project('set and get')
+
+var1 = 'test1.txt'
+var2 = files('test1.txt')[0]
+
+# Use is_disabler for accessing variables
+assert(var1 == 'test1.txt')
+assert(not is_disabler(var2))
+
+# Ensure that set variables behave correctly
+set_variable('var3', 'test2.txt')
+set_variable('var4', files('test2.txt')[0])
+
+assert(var3 == 'test2.txt')
+assert(not is_disabler(var4))
+
+# Test get_variable directly
+assert(get_variable('var1') == 'test1.txt')
+assert(not is_disabler(get_variable('var2')))
+assert(get_variable('var3') == 'test2.txt')
+assert(not is_disabler(get_variable('var4')))
+
+# Test get_variable indirectly
+
+var5 = get_variable('var1')
+var6 = get_variable('var2')
+var7 = get_variable('var3')
+var8 = get_variable('var4')
+set_variable('var9', get_variable('var7'))
+set_variable('var0', get_variable('var8'))
+
+assert(var5 == 'test1.txt')
+assert(not is_disabler(var6))
+assert(var7 == 'test2.txt')
+assert(not is_disabler(var8))
+assert(get_variable('var9') == 'test2.txt')
+assert(not is_disabler(get_variable('var0')))
+
+# test dict get
+dict = {'a': var2}
+
+dict_t1 = dict['a']
+dict_t2 = dict.get('a')
+dict_t3 = dict.get('a', var2)
+dict_t4 = dict.get('b', var2)
+
+assert(not is_disabler(dict_t1))
+assert(not is_disabler(dict_t2))
+assert(not is_disabler(dict_t3))
+assert(not is_disabler(dict_t4))
+
+# test lists
+list = [var2]
+
+list_t1 = list[0]
+list_t2 = list.get(0)
+list_t3 = list.get(0, var2)
+list_t4 = list.get(1, var2)
+
+assert(not is_disabler(list_t1))
+assert(not is_disabler(list_t2))
+assert(not is_disabler(list_t3))
+assert(not is_disabler(list_t4))
diff --git a/test cases/common/242 set and get variable/test1.txt b/test cases/common/242 set and get variable/test1.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test cases/common/242 set and get variable/test1.txt
diff --git a/test cases/common/242 set and get variable/test2.txt b/test cases/common/242 set and get variable/test2.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test cases/common/242 set and get variable/test2.txt