additional closure tests
authorStefan Behnel <scoder@users.berlios.de>
Thu, 25 Nov 2010 14:32:22 +0000 (15:32 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Thu, 25 Nov 2010 14:32:22 +0000 (15:32 +0100)
tests/run/closures_T82.pyx

index de634856759f726c25dedd75c4024b509558ba42..cb7f9c1cd01e44313db449a5e751a2caf5dceb87 100644 (file)
@@ -184,3 +184,31 @@ def more_inner_funcs(x):
         # called with (2,4,8)
         return f(a_f), g(b_g), h(b_h)
     return resolve
+
+def deep_inner():
+    """
+    >>> deep_inner()()
+    2
+    """
+    cdef int x = 1
+    def f():
+        def g():
+            def h():
+                return x+1
+            return h
+        return g()
+    return f()
+
+def deep_inner_sibling():
+    """
+    >>> deep_inner_sibling()()
+    2
+    """
+    cdef int x = 1
+    def f():
+        def g():
+            return x+1
+        def h():
+            return g()
+        return h
+    return f()