[pypy-svn] r26469 - in pypy/dist/pypy/translator/cl: . test
sanxiyn at codespeak.net
sanxiyn at codespeak.net
Fri Apr 28 02:42:45 CEST 2006
Author: sanxiyn
Date: Fri Apr 28 02:42:36 2006
New Revision: 26469
Modified:
pypy/dist/pypy/translator/cl/buildcl.py
pypy/dist/pypy/translator/cl/clrepr.py
pypy/dist/pypy/translator/cl/test/test_clrepr.py
Log:
More clrepr
Modified: pypy/dist/pypy/translator/cl/buildcl.py
==============================================================================
--- pypy/dist/pypy/translator/cl/buildcl.py (original)
+++ pypy/dist/pypy/translator/cl/buildcl.py Fri Apr 28 02:42:36 2006
@@ -4,7 +4,7 @@
from pypy.tool.udir import udir
from pypy.translator.translator import TranslationContext
from pypy.translator.cl.gencl import GenCL
-from pypy.translator.cl.clrepr import clrepr
+from pypy.translator.cl.clrepr import clrepr, repr_fun_name
from pypy import conftest
from pypy.translator.cl import conftest as clconftest
@@ -88,7 +88,7 @@
def _(*args):
fpath.write(out)
fp = file(str(fpath), "a")
- print >>fp, "(write (", clrepr(func.func_name),
+ print >>fp, "(write (", repr_fun_name(func.func_name),
for arg in args:
print >>fp, clrepr(arg),
print >>fp, "))"
Modified: pypy/dist/pypy/translator/cl/clrepr.py
==============================================================================
--- pypy/dist/pypy/translator/cl/clrepr.py (original)
+++ pypy/dist/pypy/translator/cl/clrepr.py Fri Apr 28 02:42:36 2006
@@ -9,8 +9,8 @@
def clrepr(item):
if isinstance(item, str):
if len(item) == 1:
- return "#\\" + item
- return repr_fun_name(item)
+ return "#\\%c" % (item,)
+ return '"%s"' % (item,)
if isinstance(item, bool):
if item:
return "t"
@@ -18,6 +18,8 @@
return "nil"
if isinstance(item, (int, long, float)):
return str(item)
+ if item is None:
+ return "nil"
if isinstance(item, (list, tuple)):
return "'(" + ' '.join(item) + ")"
if isinstance(item, Variable):
Modified: pypy/dist/pypy/translator/cl/test/test_clrepr.py
==============================================================================
--- pypy/dist/pypy/translator/cl/test/test_clrepr.py (original)
+++ pypy/dist/pypy/translator/cl/test/test_clrepr.py Fri Apr 28 02:42:36 2006
@@ -2,13 +2,10 @@
from pypy.translator.cl.clrepr import clrepr
def test_const():
- py.test.skip('changed')
- assert repr_const(True) == 't'
- assert repr_const(False) == 'nil'
- assert repr_const(42) == '42'
- assert repr_const(1.5) == '1.5'
- assert repr_const(None) == 'nil'
- assert repr_const('a') == '#\\a'
- assert repr_const('answer') == '"answer"'
- assert repr_const((2, 3)) == "'(2 3)"
- assert repr_const([2, 3]) == "#(2 3)"
+ assert clrepr(True) == 't'
+ assert clrepr(False) == 'nil'
+ assert clrepr(42) == '42'
+ assert clrepr(1.5) == '1.5'
+ assert clrepr(None) == 'nil'
+ assert clrepr('a') == '#\\a'
+ assert clrepr('answer') == '"answer"'
More information about the Pypy-commit
mailing list