tests/test-linelog.py
changeset 38935 27a54096c92e
parent 38924 6fed8b323651
child 41365 876494fd967d
--- a/tests/test-linelog.py	Mon Aug 06 17:19:33 2018 -0400
+++ b/tests/test-linelog.py	Mon Aug 06 22:24:00 2018 -0700
@@ -179,6 +179,15 @@
             ar = ll.annotate(rev)
             self.assertEqual([(l.rev, l.linenum) for l in ar], lines)
 
+    def testinfinitebadprogram(self):
+        ll = linelog.linelog.fromdata(
+            b'\x00\x00\x00\x00\x00\x00\x00\x02'  # header
+            b'\x00\x00\x00\x00\x00\x00\x00\x01'  # JUMP to self
+        )
+        with self.assertRaises(linelog.LineLogError):
+            # should not be an infinite loop and raise
+            ll.annotate(1)
+
 if __name__ == '__main__':
     import silenttestrunner
     silenttestrunner.main(__name__)