Add test case for ninja quoting.
This commit is contained in:
parent
7d6c6fe166
commit
abd02b3eae
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
|
||||
expected = {
|
||||
'newline': '\n',
|
||||
'dollar': '$',
|
||||
'colon': ':',
|
||||
'space': ' ',
|
||||
'multi1': ' ::$$ ::$$',
|
||||
'multi2': ' ::$$\n\n \n\n::$$',
|
||||
}
|
||||
|
||||
output = None
|
||||
|
||||
for arg in sys.argv[1:]:
|
||||
try:
|
||||
name, value = arg.split('=', 1)
|
||||
except ValueError:
|
||||
output = arg
|
||||
continue
|
||||
|
||||
if expected[name] != value:
|
||||
raise RuntimeError('{!r} is {!r} but should be {!r}'.format(name, value, expected[name]))
|
||||
|
||||
if output is not None:
|
||||
with open(output, 'w') as f:
|
||||
f.write('Success!')
|
|
@ -0,0 +1,2 @@
|
|||
usr/share/result
|
||||
usr/share/result2
|
|
@ -0,0 +1,37 @@
|
|||
project('ninja special characters' ,'c')
|
||||
|
||||
python = import('python3').find_python()
|
||||
|
||||
# Without newlines, this should appear directly in build.ninja.
|
||||
gen = custom_target('gen',
|
||||
command : [
|
||||
python,
|
||||
files('check_quoting.py'),
|
||||
'dollar=$',
|
||||
'colon=:',
|
||||
'space= ',
|
||||
'''multi1= ::$$ ::$$''',
|
||||
'@OUTPUT@'],
|
||||
output : 'result',
|
||||
install : true,
|
||||
install_dir : get_option('datadir'))
|
||||
|
||||
# With newlines, this should go through the exe wrapper.
|
||||
gen2 = custom_target('gen2',
|
||||
command : [
|
||||
python,
|
||||
files('check_quoting.py'),
|
||||
'''newline=
|
||||
''',
|
||||
'dollar=$',
|
||||
'colon=:',
|
||||
'space= ',
|
||||
'''multi2= ::$$
|
||||
|
||||
|
||||
|
||||
::$$''',
|
||||
'@OUTPUT@'],
|
||||
output : 'result2',
|
||||
install : true,
|
||||
install_dir : get_option('datadir'))
|
Loading…
Reference in New Issue