[pypy-svn] r58627 - pypy/branch/2.5-merge/pypy/interpreter/test

arigo at codespeak.net arigo at codespeak.net
Mon Oct 6 13:50:36 CEST 2008


Author: arigo
Date: Mon Oct  6 13:50:34 2008
New Revision: 58627

Modified:
   pypy/branch/2.5-merge/pypy/interpreter/test/test_interpreter.py
Log:
(iko, arigo)
Another test for MAKE_CLOSURE.


Modified: pypy/branch/2.5-merge/pypy/interpreter/test/test_interpreter.py
==============================================================================
--- pypy/branch/2.5-merge/pypy/interpreter/test/test_interpreter.py	(original)
+++ pypy/branch/2.5-merge/pypy/interpreter/test/test_interpreter.py	Mon Oct  6 13:50:34 2008
@@ -231,6 +231,17 @@
         assert self.codetest(code, 'g', [12, {}]) ==    ()
         assert self.codetest(code, 'g', [12, {3:1}]) == (3,)
 
+    def test_closure(self):
+        code = '''
+            def f(x, y):
+                def g(u, v):
+                    return u - v + 7*x
+                return g
+            def callme(x, u, v):
+                return f(x, 123)(u, v)
+            '''
+        assert self.codetest(code, 'callme', [1, 2, 3]) == 6
+
     def test_list_comprehension(self):
         code = '''
             def f():



More information about the Pypy-commit mailing list