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

santagada at codespeak.net santagada at codespeak.net
Mon May 14 23:50:33 CEST 2007


Author: santagada
Date: Mon May 14 23:50:33 2007
New Revision: 43392

Modified:
   pypy/dist/pypy/lang/js/test/test_new_parser.py
Log:
new get_instance tests, good idea from cfbolz

Modified: pypy/dist/pypy/lang/js/test/test_new_parser.py
==============================================================================
--- pypy/dist/pypy/lang/js/test/test_new_parser.py	(original)
+++ pypy/dist/pypy/lang/js/test/test_new_parser.py	Mon May 14 23:50:33 2007
@@ -290,6 +290,20 @@
         ast = self.to_ast(s)
         return ast.eval(global_context())
     
+    def test_get_instance(self):
+        from pypy.lang.js import operations
+        from pypy.rlib.parsing.tree import Symbol
+        astb = ASTBuilder()
+        t = self.parse('6')
+        assert isinstance(t, Symbol)
+        op = astb.get_instance(t, operations.Node)
+        assert op.value == '6'
+        assert op.lineno == 0
+        t = self.parse('[1,]')
+        assert not isinstance(t, Symbol)
+        op = astb.get_instance(t, operations.Node)
+        assert op.lineno == 0
+        
     def test_primaryexpression(self):
         w_num = self.eval_expr('(6)')
         assert w_num.ToNumber() == 6



More information about the Pypy-commit mailing list