[pypy-svn] r43759 - pypy/dist/pypy/lang/js/test

santagada at codespeak.net santagada at codespeak.net
Sun May 27 23:36:57 CEST 2007


Author: santagada
Date: Sun May 27 23:36:56 2007
New Revision: 43759

Added:
   pypy/dist/pypy/lang/js/test/test_operations.py
Log:
new unittest module

Added: pypy/dist/pypy/lang/js/test/test_operations.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/lang/js/test/test_operations.py	Sun May 27 23:36:56 2007
@@ -0,0 +1,24 @@
+import py
+from pypy.lang.js import interpreter
+from pypy.lang.js.operations import *
+from pypy.lang.js.jsobj import W_Number, empty_context
+
+class MOCKNode(Node):
+    def __init__(self, pos, ret):
+        self.pos = pos
+        self.ret = ret
+
+    def eval(self, ctx):
+        return self.ret
+
+POSDEF = Position()
+VALDEF = MOCKNode(POSDEF, 1)
+
+def test_return():
+    ctx = empty_context()
+    r = Return(POSDEF, VALDEF)
+    block = Block(POSDEF, [r])
+    selements = SourceElements(POSDEF, [], {}, [r])
+    br = block.execute(ctx)
+    sr = selements.execute(ctx)
+    assert br == 1 and sr == 1



More information about the Pypy-commit mailing list