summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/gold/annotate/mae/mae.py,cover10
-rw-r--r--tests/test_annotate.py20
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/gold/annotate/mae/mae.py,cover b/tests/gold/annotate/mae/mae.py,cover
new file mode 100644
index 00000000..ca086e93
--- /dev/null
+++ b/tests/gold/annotate/mae/mae.py,cover
@@ -0,0 +1,10 @@
+> def f(x):
+> if x == 1:
+> print("1")
+> else:
+> print("2")
+
+> if f(1):
+! print("nope")
+> if f(2):
+! print("nope")
diff --git a/tests/test_annotate.py b/tests/test_annotate.py
index de6edcd0..f85450c7 100644
--- a/tests/test_annotate.py
+++ b/tests/test_annotate.py
@@ -105,3 +105,23 @@ class AnnotationGoldTest(CoverageTest):
self.start_import_stop(cov, "white")
cov.annotate()
compare(gold_path("annotate/annotate"), ".", "*,cover")
+
+ def test_missing_after_else(self):
+ self.make_file("mae.py", """\
+ def f(x):
+ if x == 1:
+ print("1")
+ else:
+ print("2")
+
+ if f(1):
+ print("nope")
+ if f(2):
+ print("nope")
+ """)
+
+ cov = coverage.Coverage()
+ self.start_import_stop(cov, "mae")
+ cov.annotate()
+ assert self.stdout() == "1\n2\n"
+ compare(gold_path("annotate/mae"), ".", "*,cover")