diff options
author | Thibault Saunier <saunierthibault@gmail.com> | 2016-09-14 17:11:27 -0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-09-14 23:11:27 +0300 |
commit | a2e7ebc575a47bfb3dfb774591cde3fdc6873dc9 (patch) | |
tree | bde1198cb0fde59c2ca09b78ff7a832a38aad238 /test cases | |
parent | 8fd8c16a879742a840b8f3a431539a261b8552ba (diff) | |
download | meson-a2e7ebc575a47bfb3dfb774591cde3fdc6873dc9.zip meson-a2e7ebc575a47bfb3dfb774591cde3fdc6873dc9.tar.gz meson-a2e7ebc575a47bfb3dfb774591cde3fdc6873dc9.tar.bz2 |
Add a new 'environment' object to be used to build test environment (#781)
Allowing user to fine tune tests environment variables
Diffstat (limited to 'test cases')
-rw-r--r-- | test cases/common/48 test args/envvars.c | 10 | ||||
-rw-r--r-- | test cases/common/48 test args/meson.build | 8 |
2 files changed, 16 insertions, 2 deletions
diff --git a/test cases/common/48 test args/envvars.c b/test cases/common/48 test args/envvars.c index 114df5e..627e413 100644 --- a/test cases/common/48 test args/envvars.c +++ b/test cases/common/48 test args/envvars.c @@ -4,12 +4,20 @@ int main(int argc, char **argv) { if(strcmp(getenv("first"), "val1") != 0) { - fprintf(stderr, "First envvar is wrong.\n"); + fprintf(stderr, "First envvar is wrong. %s\n", getenv("first")); return 1; } if(strcmp(getenv("second"), "val2") != 0) { fprintf(stderr, "Second envvar is wrong.\n"); return 1; } + if(strcmp(getenv("third"), "val3:and_more") != 0) { + fprintf(stderr, "Third envvar is wrong.\n"); + return 1; + } + if(strstr(getenv("PATH"), "fakepath:") != NULL) { + fprintf(stderr, "Third envvar is wrong.\n"); + return 1; + } return 0; } diff --git a/test cases/common/48 test args/meson.build b/test cases/common/48 test args/meson.build index f81450c..6400198 100644 --- a/test cases/common/48 test args/meson.build +++ b/test cases/common/48 test args/meson.build @@ -3,6 +3,12 @@ project('test features', 'c') e1 = executable('cmd_args', 'cmd_args.c') e2 = executable('envvars', 'envvars.c') +env = environment() +env.set('first', 'val1') +env.set('second', 'val2') +env.set('third', 'val3', 'and_more', separator: ':') +env.append('PATH', 'fakepath', separator: ':') + test('command line arguments', e1, args : ['first', 'second']) -test('environment variables', e2, env : ['first=val1', 'second=val2']) +test('environment variables', e2, env : env) test('file arg', find_program('tester.py'), args : files('testfile.txt')) |