| 8 | executable = "${TESTPROG}" |
| 9 | |
| 10 | def parse_test(raw): |
| 11 | raw = re.compile('#.*$', re.M).sub('', raw).strip() |
| 12 | if raw.startswith('"""'): |
| 13 | raw = raw[3:] |
| 14 | |
| 15 | for fixture in raw.split('r"""'): |
| 16 | name = '' |
| 17 | doc, _, body = fixture.partition('"""') |
| 18 | cases = [] |
| 19 | for case in body.split('$')[1:]: |
| 20 | argv, _, expect = case.strip().partition('\n') |
| 21 | expect = json.loads(expect) |
| 22 | prog, _, argv = argv.strip().partition(' ') |
| 23 | cases.append((prog, argv, expect)) |
| 24 | |
| 25 | yield name, doc, cases |
| 26 | |
| 27 | failures = 0 |
| 28 | passes = 0 |