Add test case for ninja quoting.

pull/1657/head
Elliott Sales de Andrade 8 years ago
parent 7d6c6fe166
commit abd02b3eae
  1. 28
      test cases/common/149 special characters/check_quoting.py
  2. 2
      test cases/common/149 special characters/installed_files.txt
  3. 37
      test cases/common/149 special characters/meson.build

@ -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…
Cancel
Save