diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2021-03-23 11:48:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-23 17:48:17 +0200 |
commit | 1be13710adba2126f5731fccdf698a9d405a9d67 (patch) | |
tree | 6b2c2038b9003b3a85a265c1525daae9139b1a98 /test cases | |
parent | de9df5128c03d016ec9463f705422f2e1df4c49a (diff) | |
download | meson-1be13710adba2126f5731fccdf698a9d405a9d67.zip meson-1be13710adba2126f5731fccdf698a9d405a9d67.tar.gz meson-1be13710adba2126f5731fccdf698a9d405a9d67.tar.bz2 |
environment(): Allow stacking append() and prepend() (#8547)
* environment(): Allow stacking append() and prepend()
* Update docs/markdown/Reference-manual.md
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Diffstat (limited to 'test cases')
4 files changed, 12 insertions, 21 deletions
diff --git a/test cases/common/34 run program/check-env.py b/test cases/common/34 run program/check-env.py new file mode 100644 index 0000000..7f106c6 --- /dev/null +++ b/test cases/common/34 run program/check-env.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import os + +assert os.environ['MY_PATH'] == os.pathsep.join(['0', '1', '2']) + diff --git a/test cases/common/34 run program/meson.build b/test cases/common/34 run program/meson.build index 93897e3..8e472fd 100644 --- a/test cases/common/34 run program/meson.build +++ b/test cases/common/34 run program/meson.build @@ -77,3 +77,9 @@ if dd.found() assert(ret.returncode() == 0, 'failed to run dd: ' + ret.stderr()) assert(ret.stdout() == '', 'stdout is "@0@" instead of empty'.format(ret.stdout())) endif + +env = environment() +env.append('MY_PATH', '1') +env.append('MY_PATH', '2') +env.prepend('MY_PATH', '0') +run_command('check-env.py', env: env, check: true) diff --git a/test cases/unit/63 test env does not stack/meson.build b/test cases/unit/63 test env does not stack/meson.build deleted file mode 100644 index 01f2637..0000000 --- a/test cases/unit/63 test env does not stack/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -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/63 test env does not stack/script.py b/test cases/unit/63 test env does not stack/script.py deleted file mode 100755 index 2a76673..0000000 --- a/test cases/unit/63 test env does not stack/script.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/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) |