[pypy-svn] r26265 - in pypy/dist/pypy/translator/cl: . test

sanxiyn at codespeak.net sanxiyn at codespeak.net
Mon Apr 24 16:25:27 CEST 2006


Author: sanxiyn
Date: Mon Apr 24 16:25:22 2006
New Revision: 26265

Added:
   pypy/dist/pypy/translator/cl/test/test_buildcl.py
Modified:
   pypy/dist/pypy/translator/cl/buildcl.py
Log:
Move tests from buildcl.py's __name__ == '__main__' block
to the proper place


Modified: pypy/dist/pypy/translator/cl/buildcl.py
==============================================================================
--- pypy/dist/pypy/translator/cl/buildcl.py	(original)
+++ pypy/dist/pypy/translator/cl/buildcl.py	Mon Apr 24 16:25:22 2006
@@ -121,16 +121,3 @@
         output = cmdexec("%s %s" % (cl, str(fpath)))
         return readlisp(output)
     return _
-
-if __name__ == '__main__':
-    # for test
-    # ultimately, GenCL's str and conv will move to here
-    def f(): pass
-    fun = FlowObjSpace().build_flow(f)
-    gen = GenCL(fun)
-
-    what = [True, "universe", 42, None, ("of", "them", ["eternal", 95])]
-    it = writelisp(what)
-    print what
-    print it
-    assert it == '#(t "universe" 42 nil \'("of" "them" #("eternal" 95)))'

Added: pypy/dist/pypy/translator/cl/test/test_buildcl.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/cl/test/test_buildcl.py	Mon Apr 24 16:25:22 2006
@@ -0,0 +1,10 @@
+from pypy.translator.cl.buildcl import writelisp
+
+def test_write():
+    assert writelisp(True) == 't'
+    assert writelisp(False) == 'nil'
+    assert writelisp(42) == '42'
+    assert writelisp(None) == 'nil'
+    assert writelisp('answer') == '"answer"'
+    assert writelisp((2, 3)) == "'(2 3)"
+    assert writelisp([2, 3]) == "#(2 3)"



More information about the Pypy-commit mailing list