[pypy-svn] r26491 - pypy/dist/pypy/translator/cl/test

sanxiyn at codespeak.net sanxiyn at codespeak.net
Fri Apr 28 07:12:59 CEST 2006


Author: sanxiyn
Date: Fri Apr 28 07:12:56 2006
New Revision: 26491

Added:
   pypy/dist/pypy/translator/cl/test/test_exception.py
Log:
Add a failing test for exception handling


Added: pypy/dist/pypy/translator/cl/test/test_exception.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/cl/test/test_exception.py	Fri Apr 28 07:12:56 2006
@@ -0,0 +1,21 @@
+import py
+from pypy.translator.cl.buildcl import make_cl_func
+
+def test_handle_exception():
+    py.test.skip("TODO")
+    class MyException(Exception):
+        pass
+    def raise_exception():
+        # This is in a separate function to fool RTyper
+        raise MyException()
+    def handle_exception(flag):
+        try:
+            if flag:
+                raise_exception()
+            else:
+                return 2
+        except MyException:
+            return 1
+    cl_handle_exception = make_cl_func(handle_exception, [bool])
+    assert cl_handle_exception(True) == 1
+    assert cl_handle_exception(False) == 2



More information about the Pypy-commit mailing list