| 1 |
project('180 escape', 'c') |
| 2 |
|
| 3 |
gen = generator(find_program('file.py'), arguments:['@INPUT@', 'erd\u0151', '@OUTPUT@'], output: '@BASENAME@') |
| 4 |
|
| 5 |
gen_file = gen.process('file.c.in') |
| 6 |
|
| 7 |
find_file_list = run_command(find_program('find.py'), check: true) |
| 8 |
assert(find_file_list.returncode() == 0, 'Didn\'t find any files.') |
| 9 |
|
| 10 |
# Strings should support both octal \ooo and hex \xhh encodings |
| 11 |
|
| 12 |
found_files_oct = [] |
| 13 |
foreach l : find_file_list.stdout().strip('\0').split('\000') |
| 14 |
found_files_oct += [files(l)] |
| 15 |
endforeach |
| 16 |
|
| 17 |
test('first', executable('first', found_files_oct + [gen_file])) |
| 18 |
|
| 19 |
found_files_hex = [] |
| 20 |
foreach l : find_file_list.stdout().strip('\x00').split('\x00') |
| 21 |
found_files_hex += [files(l)] |
| 22 |
endforeach |
| 23 |
|
| 24 |
test('second', executable('second', found_files_hex + [gen_file])) |
| 25 |
|
| 26 |
# Unrecognized and malformed escape sequences are literal |
| 27 |
|
| 28 |
malformed = [ |
| 29 |
[ '\c', 'c' ], |
| 30 |
[ '\Uabcdefghi', 'Uabcdefghi'], |
| 31 |
[ '\u123 ', 'u123 '], |
| 32 |
[ '\xqr', 'xqr'], |
| 33 |
] |
| 34 |
|
| 35 |
foreach m : malformed |
| 36 |
assert(m[0].endswith(m[1]), 'bad escape sequence had unexpected end') |
| 37 |
assert(m[0].startswith('\\'), 'bad escape sequence had unexpected start') |
| 38 |
endforeach |