summaryrefslogtreecommitdiff
path: root/subplot.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-05-24 18:55:04 +0300
committerLars Wirzenius <liw@liw.fi>2020-05-24 19:04:50 +0300
commit79c8df044deafe4463bedd7f87571d2ac1ba48ba (patch)
treec26484d0275de3a74552a6c7cc57b7455e5ca5c0 /subplot.py
parente889ebdef94434109e63847e39d0c979569c44c0 (diff)
downloadsubplot-79c8df044deafe4463bedd7f87571d2ac1ba48ba.tar.gz
test: add scenarios to verify newline adding to embedded files
Diffstat (limited to 'subplot.py')
-rw-r--r--subplot.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/subplot.py b/subplot.py
index bf6415f..fa3d502 100644
--- a/subplot.py
+++ b/subplot.py
@@ -107,5 +107,24 @@ def json_output_matches_file(ctx, filename=None):
assert_dict_eq(actual, expected)
+def file_ends_in_zero_newlines(ctx, filename=None):
+ content = open(filename, "r").read()
+ print("content:", repr(content))
+ assert_ne(content[-1], "\n")
+
+
+def file_ends_in_one_newline(ctx, filename=None):
+ content = open(filename, "r").read()
+ print("content:", repr(content))
+ assert_eq(content[-1], "\n")
+ assert_ne(content[-2], "\n")
+
+
+def file_ends_in_two_newlines(ctx, filename=None):
+ content = open(filename, "r").read()
+ print("content:", repr(content))
+ assert_eq(content[-2:], "\n\n")
+
+
def binary(basename):
return os.path.join(srcdir, "target", "debug", basename)