| 1 |
# testcase by blue42u |
| 2 |
project('test') |
| 3 |
python3 = find_program('python3') |
| 4 |
|
| 5 |
gen_code = ''' |
| 6 |
import sys, pathlib |
| 7 |
pathlib.Path(sys.argv[1]).write_text("foo") |
| 8 |
pathlib.Path(sys.argv[2]).write_text("bar")''' |
| 9 |
foobar_txt = custom_target(command: [python3, '-c', gen_code, '@OUTPUT@'], output: ['foo.txt', 'bar.txt']) |
| 10 |
|
| 11 |
test_code = ''' |
| 12 |
import sys, pathlib |
| 13 |
sys.exit(0 if pathlib.Path(sys.argv[1]).read_text() == sys.argv[2] else 4)''' |
| 14 |
|
| 15 |
test('foo.txt', python3, args: ['-c', test_code, foobar_txt[0], 'foo']) |
| 16 |
test('bar.txt', python3, args: ['-c', test_code, foobar_txt[1], 'bar']) |