summaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2019-04-13 11:25:58 +0530
committerJussi Pakkanen <jpakkane@gmail.com>2019-04-13 22:53:33 +0300
commit10468b3a28836bc2f8e60cb27af7a7b1c30dc189 (patch)
treedc2cb6db242169d26da540a13aeca1c55bfad48d /test cases
parentc04651fe241ebaa4a32e49590416b0bbabebc5fa (diff)
downloadmeson-10468b3a28836bc2f8e60cb27af7a7b1c30dc189.tar.gz
interpreter: Warn when environment() ops are overriden
Warn when someone tries to use append() or prepend() on an env var which already has an operation set on it. People seem to think that multiple append/prepend operations stack, but they don't. Closes https://github.com/mesonbuild/meson/issues/5087
Diffstat (limited to 'test cases')
-rw-r--r--test cases/unit/59 test env doesn't stack/meson.build12
-rwxr-xr-xtest cases/unit/59 test env doesn't stack/script.py9
2 files changed, 21 insertions, 0 deletions
diff --git a/test cases/unit/59 test env doesn't stack/meson.build b/test cases/unit/59 test env doesn't stack/meson.build
new file mode 100644
index 000000000..01f2637de
--- /dev/null
+++ b/test cases/unit/59 test env doesn't stack/meson.build
@@ -0,0 +1,12 @@
+project('test env var stacking')
+
+testenv = environment()
+testenv.set('TEST_VAR_SET', 'some-value')
+testenv.set('TEST_VAR_APPEND', 'some-value')
+testenv.set('TEST_VAR_PREPEND', 'some-value')
+
+testenv.append('TEST_VAR_APPEND', 'another-value-append', separator: ':')
+testenv.prepend('TEST_VAR_PREPEND', 'another-value-prepend', separator: ':')
+testenv.set('TEST_VAR_SET', 'another-value-set')
+
+test('check env', find_program('script.py'), env: testenv)
diff --git a/test cases/unit/59 test env doesn't stack/script.py b/test cases/unit/59 test env doesn't stack/script.py
new file mode 100755
index 000000000..2a766732e
--- /dev/null
+++ b/test cases/unit/59 test env doesn't stack/script.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python3
+
+import os
+
+for name in ('append', 'prepend', 'set'):
+ envname = 'TEST_VAR_' + name.upper()
+ value = 'another-value-' + name
+ envvalue = os.environ[envname]
+ assert (envvalue == value), (name, envvalue)