| 1 |
#!/usr/bin/env python3 |
| 2 |
|
| 3 |
import sys |
| 4 |
|
| 5 |
expected = { |
| 6 |
'newline': '\n', |
| 7 |
'dollar': '$', |
| 8 |
'colon': ':', |
| 9 |
'space': ' ', |
| 10 |
'multi1': ' ::$$ ::$$', |
| 11 |
'multi2': ' ::$$\n\n \n\n::$$', |
| 12 |
} |
| 13 |
|
| 14 |
output = None |
| 15 |
|
| 16 |
for arg in sys.argv[1:]: |
| 17 |
try: |
| 18 |
name, value = arg.split('=', 1) |
| 19 |
except ValueError: |
| 20 |
output = arg |
| 21 |
continue |
| 22 |
|
| 23 |
if expected[name] != value: |
| 24 |
raise RuntimeError('{!r} is {!r} but should be {!r}'.format(name, value, expected[name])) |
| 25 |
|
| 26 |
if output is not None: |
| 27 |
with open(output, 'w', encoding='utf-8') as f: |
| 28 |
f.write('Success!') |