diff --git a/Tst/json_to_barescript.py b/Tst/json_to_barescript.py index 70937028f30520895b832e29ab56bf37b7428100..de0eafd65f2e76597f09241722af299ee10592bb 100755 --- a/Tst/json_to_barescript.py +++ b/Tst/json_to_barescript.py @@ -45,7 +45,7 @@ def run(jfile, outfile, reportfunc=False, specfile=None): script += 'ask_tc_exec = True\n' script += 'report = cfl.TestReport(specfile, rep_version, mib_version, gui=True)\n\n' - script += '# Precond.\n# {}\n#! CCS.BREAKPOINT\n\n'.format(data['_precon_descr']) + script += '# Precond.\n# {}\n#! CCS.BREAKPOINT\n\n'.format(replace_newline(data['_precon_descr'])) # script += '{}\n\n\n'.format(data['_precon_code'].strip()) # Add the precondition code for step in data['sequences'][0]['steps']: @@ -74,7 +74,7 @@ def run(jfile, outfile, reportfunc=False, specfile=None): script += txt - script += '# Postcond.\n# {}\n'.format(data['_postcon_descr']) + script += '# Postcond.\n# {}\n'.format(replace_newline(data['_postcon_descr'])) # script += data['_postcon_code'].strip() # Add the postcondition code if reportfunc: @@ -87,6 +87,10 @@ def run(jfile, outfile, reportfunc=False, specfile=None): fd.write(script) +def replace_newline(txt): + return txt.strip().replace('\n', '\n# ') + + if __name__ == '__main__': json_file_path = sys.argv[1]