summaryrefslogtreecommitdiff
path: root/subplot.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-05-24 10:49:37 +0300
committerDaniel Silverstone <dsilvers@digital-scurf.org>2020-05-24 08:58:10 +0100
commitf039dc7fcb3e9dd20166ecfe64d5428a812d5990 (patch)
tree0f09e6d77880b3673d6760e78642280d5de0c662 /subplot.py
parentbbdb40ac56d67ffb0d5a1cf582fe15740f1283ce (diff)
downloadsubplot-f039dc7fcb3e9dd20166ecfe64d5428a812d5990.tar.gz
test(sp-meta): amend scenario to also test JSON output
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)