diff options
Diffstat (limited to 'ftt-codegen')
-rwxr-xr-x | ftt-codegen | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ftt-codegen b/ftt-codegen index c54a383..694cc05 100755 --- a/ftt-codegen +++ b/ftt-codegen @@ -118,8 +118,10 @@ def codegen(f, step, bindings): keyword = words[0] rest = ' '.join(words[1:]) function, args = find_binding(bindings, keyword, rest) - f.write('args = {}\n'.format(json.dumps(args))) - f.write('{}(run.get_context(), **args)\n'.format(function)) + f.write(' logging.info("step %s", {})\n'.format(json.dumps(step))) + f.write(' args = {}\n'.format(json.dumps(args))) + f.write(' logging.debug("calling {} with args %s", args)\n'.format(function)) + f.write(' {}(run.get_context(), **args)\n\n'.format(function)) def debug(msg): if False: @@ -134,6 +136,7 @@ debug('reading prelude') prelude = open(sys.argv[2]).read() sys.stdout.write(hardcoded) sys.stdout.write(prelude) +sys.stdout.write('\n') debug('reading inputs') text = ''.join(open(filename).read() for filename in sys.argv[3:]) @@ -154,9 +157,9 @@ for s in fable.get_scenarios(): f = sys.stdout for s in scenarios: name = s.get_name() - f.write('run.start("{}")\n'.format(name)) + f.write('\nif run.start("{}"):\n'.format(name)) for step in s.get_steps(): codegen(f, step, bindings) - f.write('run.end()\n') + f.write(' run.end()\n') debug('ok') |