[pypy-svn] r70473 - pypy/branch/c-traceback/pypy/translator/c/test

arigo at codespeak.net arigo at codespeak.net
Sat Jan 9 21:54:31 CET 2010


Author: arigo
Date: Sat Jan  9 21:54:30 2010
New Revision: 70473

Modified:
   pypy/branch/c-traceback/pypy/translator/c/test/test_standalone.py
Log:
Another test.


Modified: pypy/branch/c-traceback/pypy/translator/c/test/test_standalone.py
==============================================================================
--- pypy/branch/c-traceback/pypy/translator/c/test/test_standalone.py	(original)
+++ pypy/branch/c-traceback/pypy/translator/c/test/test_standalone.py	Sat Jan  9 21:54:30 2010
@@ -410,6 +410,30 @@
         assert lines2[-3] != lines[-3]
         assert lines2[-2] == lines[-2]
 
+    def test_assertion_error(self):
+        def g(x):
+            assert x != 1
+        def f(argv):
+            try:
+                g(len(argv))
+            finally:
+                print 'done'
+        def entry_point(argv):
+            f(argv)
+            return 0
+        t, cbuilder = self.compile(entry_point)
+        out, err = cbuilder.cmdexec("", expect_crash=True)
+        assert out.strip() == ''
+        lines = err.strip().splitlines()
+        assert lines[-1] == 'Fatal RPython error: AssertionError'
+        assert len(lines) >= 4
+        l0, l1, l2 = lines[-4:-1]
+        assert l0 == 'RPython traceback:'
+        assert re.match(r'  File "\w+.c", line \d+, in g', l1)
+        assert re.match(r'  File "\w+.c", line \d+, in f', l2)
+        # The traceback stops at f() because it's the first function that
+        # captures the AssertionError, which makes the program abort.
+
 
 class TestMaemo(TestStandalone):
     def setup_class(cls):



More information about the Pypy-commit mailing list