1project('test features', 'c')
2
3e1 = executable('cmd_args', 'cmd_args.c')
4e2 = executable('envvars', 'envvars.c')
5e3 = executable('env2vars', 'env2vars.c')
6
7env = environment()
8env.set('first', 'val1')
9env.set('second', 'val2')
10env.set('third', 'val3', 'and_more', separator: ':')
11env.append('PATH', 'fakepath', separator: ':')
12
13# Make sure environment objects are copied on assignment and we can
14# change the copy without affecting the original environment object.
15env2 = env
16env2.set('first', 'something-else')
17
18test('command line arguments', e1, args : ['first', 'second'])
19test('environment variables', e2, env : env)
20test('environment variables 2', e3, env : env2)
21
22# https://github.com/mesonbuild/meson/issues/2211#issuecomment-327741571
23env_array = ['MESONTESTING=picklerror']
24testfile = files('testfile.txt')
25testerpy = find_program('tester.py')
26test('file arg', testerpy, args : testfile, env : [env_array, 'TEST_LIST_FLATTENING=1'])
27
28copy = find_program('copyfile.py')
29tester = executable('tester', 'tester.c')
30testfilect = custom_target('testfile',
31                           input : testfile,
32                           output : 'outfile.txt',
33                           build_by_default : true,
34                           command : [copy, '@INPUT@', '@OUTPUT@'])
35test('custom target arg', tester, args : testfilect, env : env_array)
36