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

santagada at codespeak.net santagada at codespeak.net
Sun Apr 29 20:20:45 CEST 2007


Author: santagada
Date: Sun Apr 29 20:20:45 2007
New Revision: 42439

Modified:
   pypy/dist/pypy/lang/js/test/test_new_parser.py
Log:
simplified test creation and made some tests with shifts and logical ops

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	Sun Apr 29 20:20:45 2007
@@ -106,16 +106,28 @@
         assert result1 == result2
         return tree
 
-    def test_simple(self):
-        self.parse_and_evaluate("1")
-        self.parse_and_evaluate("1 + 2")
-        self.parse_and_evaluate("1 - 2")
-        self.parse_and_evaluate("1 * 2")
-        self.parse_and_evaluate("1 / 2")
+    def parse_all(self, l):
+        for i in l:
+            self.parse_and_evaluate(i)
 
+    def test_simple(self):
+        self.parse_all(["1",
+                        "1 + 2",
+                        "1 - 2",
+                        "1 * 2",
+                        "1 / 2",
+                        "1 >> 2",
+                        "4 % 2",
+                        "4 | 1",
+                        "4 ^ 2",
+        ])
+        
     def test_chained(self):
-        self.parse_and_evaluate("1 + 2 * 3")
-        self.parse_and_evaluate("1 * 2 + 3")
-        self.parse_and_evaluate("1 - 3 - 3")
-        self.parse_and_evaluate("4 / 2 / 2")
+        self.parse_all(["1 + 2 * 3",
+                        "1 * 2 + 3",
+                        "1 - 3 - 3",
+                        "4 / 2 / 2",
+                        "2 << 4 << 4",
+                        "30 | 3 & 5",
+        ])
         



More information about the Pypy-commit mailing list