summaryrefslogtreecommitdiff
path: root/subplot.py
diff options
context:
space:
mode:
Diffstat (limited to 'subplot.py')
-rw-r--r--subplot.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/subplot.py b/subplot.py
index 9e16168..bf6415f 100644
--- a/subplot.py
+++ b/subplot.py
@@ -1,3 +1,4 @@
+import json
import os
import re
import subprocess
@@ -54,6 +55,12 @@ def run_meta(ctx, filename=None):
exit_code_is(ctx, 0)
+def run_meta_json(ctx, filename=None):
+ meta = binary("sp-meta")
+ runcmd(ctx, [meta, filename, "-o", "json"])
+ exit_code_is(ctx, 0)
+
+
def run_pandoc_with_filter(ctx, filename=None, output=None):
sp_filter = binary("sp-filter")
runcmd(ctx, ["pandoc", "--filter", sp_filter, filename, "-o", output])
@@ -94,5 +101,11 @@ def cleanup_was_not_run(ctx, keyword=None, name=None):
stdout_does_not_contain(ctx, pattern="\n cleanup: {} {}\n".format(keyword, name))
+def json_output_matches_file(ctx, filename=None):
+ actual = json.loads(ctx["stdout"])
+ expected = json.load(open(filename))
+ assert_dict_eq(actual, expected)
+
+
def binary(basename):
return os.path.join(srcdir, "target", "debug", basename)