diff options
author | Stian Selnes <stian@pexip.com> | 2018-11-12 10:33:49 +0100 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2018-11-12 16:23:59 +0530 |
commit | 0821462ce382541e120d8d6cfc1a3224a492b275 (patch) | |
tree | 67ca584e5f619ab6beabdc67c930f83ceb7df658 /test cases/unit | |
parent | 50b2ef7354b503ae62abd504cdce938c390b358f (diff) | |
download | meson-0821462ce382541e120d8d6cfc1a3224a492b275.zip meson-0821462ce382541e120d8d6cfc1a3224a492b275.tar.gz meson-0821462ce382541e120d8d6cfc1a3224a492b275.tar.bz2 |
Add kwarg is_default to add_test_setup()
is_default may be used to set the name of the test setup that will be
used by default whenever the option --setup is not given.
Fixes #4430
Diffstat (limited to 'test cases/unit')
-rw-r--r-- | test cases/unit/47 testsetup default/envcheck.py | 11 | ||||
-rw-r--r-- | test cases/unit/47 testsetup default/meson.build | 23 |
2 files changed, 34 insertions, 0 deletions
diff --git a/test cases/unit/47 testsetup default/envcheck.py b/test cases/unit/47 testsetup default/envcheck.py new file mode 100644 index 0000000..6ba3093 --- /dev/null +++ b/test cases/unit/47 testsetup default/envcheck.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +import os + +assert('ENV_A' in os.environ) +assert('ENV_B' in os.environ) +assert('ENV_C' in os.environ) + +print('ENV_A is', os.environ['ENV_A']) +print('ENV_B is', os.environ['ENV_B']) +print('ENV_C is', os.environ['ENV_C']) diff --git a/test cases/unit/47 testsetup default/meson.build b/test cases/unit/47 testsetup default/meson.build new file mode 100644 index 0000000..bdd35b8 --- /dev/null +++ b/test cases/unit/47 testsetup default/meson.build @@ -0,0 +1,23 @@ +project('testsetup default', 'c') + +envcheck = find_program('envcheck.py') + +# Defining ENV_A in test-env should overwrite ENV_A from test setup +env_1 = environment() +env_1.set('ENV_A', '1') +test('test-env', envcheck, env: env_1) + +# Defining default env which is used unless --setup is given or the +# env variable is defined in the test. +env_2 = environment() +env_2.set('ENV_A', '2') +env_2.set('ENV_B', '2') +env_2.set('ENV_C', '2') +add_test_setup('mydefault', env: env_2, is_default: true) + +# Defining a test setup that will update some of the env variables +# from the default test setup. +env_3 = env_2 +env_3.set('ENV_A', '3') +env_3.set('ENV_B', '3') +add_test_setup('other', env: env_3) |