diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-01-11 08:47:29 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-01-11 09:20:52 +0200 |
commit | 8de61284477998ba05423fb59a217601f01c510b (patch) | |
tree | f030d58ef7f3145aa6e165d2e9c144ecc86336c1 /subplot.py | |
parent | 3b88942f992792a568cf4e8839ad1c136e34ace0 (diff) | |
download | subplot-8de61284477998ba05423fb59a217601f01c510b.tar.gz |
Add: scenarios for testing sp-filter, dot and roadmap graphs
Diffstat (limited to 'subplot.py')
-rw-r--r-- | subplot.py | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -1,4 +1,5 @@ import os +import re import subprocess def create_file(ctx, filename=None): @@ -16,9 +17,20 @@ def run_codegen(ctx, filename=None): runcmd(ctx, [codegen, filename, '-o', 'test.py', '--run', '--templates', tmpldir]) exit_code_zero(ctx) +def run_pandoc_with_filter(ctx, filename=None, output=None): + sp_filter = binary('sp-filter') + runcmd(ctx, ['pandoc', '--filter', sp_filter, filename, '-o', output]) + exit_code_zero(ctx) + def file_exists(ctx, filename=None): assert_eq(os.path.exists(filename), True) +def file_matches(ctx, filename=None, regex=None): + with open(filename) as f: + content = f.read() + m = re.search(regex, content) + assert_eq(bool(m), True) + def scenario_was_run(ctx, name=None): stdout_matches(ctx, '\nrunning scenario: {}\n'.format(name)) |