Debian Codegraph @

test cases/common/141 special characters/meson.build

raw
1 project('ninja special characters' ,'c')
2
3 python = import('python3').find_python()
4
5 # Without newlines, this should appear directly in build.ninja.
6 gen = custom_target('gen',
7 command : [
8 python,
9 files('check_quoting.py'),
10 'dollar=$',
11 'colon=:',
12 'space= ',
13 '''multi1= ::$$ ::$$''',
14 '@OUTPUT@'],
15 output : 'result',
16 install : true,
17 install_dir : get_option('datadir'))
18
19 # With newlines, this should go through the exe wrapper.
20 gen2 = custom_target('gen2',
21 command : [
22 python,
23 files('check_quoting.py'),
24 '''newline=
25 ''',
26 'dollar=$',
27 'colon=:',
28 'space= ',
29 '''multi2= ::$$
30
31
32
33 ::$$''',
34 '@OUTPUT@'],
35 output : 'result2',
36 install : true,
37 install_dir : get_option('datadir'))
38
39 # Test that we can pass these special characters in compiler arguments
40 #
41 # (this part of the test is crafted so we don't try to use these special
42 # characters in filenames or target names)
43 #
44 # TODO: similar tests needed for languages other than C
45 # TODO: add similar test for quote, doublequote, and hash, carefully
46 # Re hash, see
47 # https://docs.microsoft.com/en-us/cpp/build/reference/d-preprocessor-definitions
48
49 special = [
50 ['amp', '&'],
51 ['at', '@'],
52 ['backslash', '\\'],
53 ['dollar', '$'],
54 ['gt', '>'],
55 ['lt', '<'],
56 ['slash', '/'],
57 ]
58
59 cc = meson.get_compiler('c')
60
61 foreach s : special
62 args = '-DCHAR="@0@"'.format(s[1])
63 e = executable('arg-string-' + s[0], 'arg-string-test.c', c_args: args)
64 test('arg-string-' + s[0], e, args: s[1])
65
66 args = '-DCHAR=@0@'.format(s[1])
67 e = executable('arg-unquoted-' + s[0], 'arg-unquoted-test.c', c_args: args)
68 test('arg-unquoted-' + s[0], e, args: s[1])
69 endforeach
70
71 foreach s : special
72 args = '-DCHAR=\'@0@\''.format(s[1])
73 e = executable('arg-char-' + s[0], 'arg-char-test.c', c_args: args)
74 test('arg-char-' + s[0], e, args: s[1])
75 endforeach