[pypy-svn] r14992 - pypy/dist/pypy/translator/c/test

ericvrp at codespeak.net ericvrp at codespeak.net
Mon Jul 25 00:09:19 CEST 2005


Author: ericvrp
Date: Mon Jul 25 00:09:19 2005
New Revision: 14992

Modified:
   pypy/dist/pypy/translator/c/test/test_exception.py
Log:
Added a failing exception test. The 'main' block has a KeyError and IndexError exit, but there is never an exception raised

Modified: pypy/dist/pypy/translator/c/test/test_exception.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_exception.py	(original)
+++ pypy/dist/pypy/translator/c/test/test_exception.py	Mon Jul 25 00:09:19 2005
@@ -5,6 +5,23 @@
 class MyException(Exception):
     pass
 
+def test_simple2(): #taken from ../../llvm2/test/test_exception.py 
+    def fn(n):
+        lst = range(10)
+        try:
+            lst[n]
+        except:
+            return 2
+        return 4
+    t = Translator(fn)
+    t.annotate([int]).simplify()
+    t.specialize()
+    #t.view()
+    f = t.ccompile()
+    assert f(-1) == fn(-1)
+    assert f( 0) == fn( 0)
+    assert f(10) == fn(10)
+
 def test_myexception():
     def g():
         raise MyException



More information about the Pypy-commit mailing list