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/5087pull/5261/head
parent
c04651fe24
commit
10468b3a28
5 changed files with 48 additions and 1 deletions
@ -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) |
@ -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) |
Loading…
Reference in new issue