[pypy-svn] r14817 - in pypy/dist/pypy/rpython: . test

pedronis at codespeak.net pedronis at codespeak.net
Wed Jul 20 15:35:57 CEST 2005


Author: pedronis
Date: Wed Jul 20 15:35:54 2005
New Revision: 14817

Modified:
   pypy/dist/pypy/rpython/rlist.py
   pypy/dist/pypy/rpython/rstr.py
   pypy/dist/pypy/rpython/test/test_rstr.py
Log:
typo fixes & test



Modified: pypy/dist/pypy/rpython/rlist.py
==============================================================================
--- pypy/dist/pypy/rpython/rlist.py	(original)
+++ pypy/dist/pypy/rpython/rlist.py	Wed Jul 20 15:35:54 2005
@@ -548,7 +548,7 @@
 def ll_mul(l, f):
     items = l.items
     length = len(items)
-    if lenght == 0 or f <= 0:
+    if length == 0 or f <= 0:
         return ll_newlist(typeOf(l), 0)
 
     resultlen = length * f

Modified: pypy/dist/pypy/rpython/rstr.py
==============================================================================
--- pypy/dist/pypy/rpython/rstr.py	(original)
+++ pypy/dist/pypy/rpython/rstr.py	Wed Jul 20 15:35:54 2005
@@ -370,7 +370,7 @@
         return hop.gendirectcall(ll_char_mul, v_char, v_int)
     rtype_inplace_mul = rtype_mul
 
-class __extend__(pairtype(IntegetRepr, CharRepr)):
+class __extend__(pairtype(IntegerRepr, CharRepr)):
     def rtype_mul(_, hop):
         v_int, v_char = hop.inputargs(Signed, char_repr)
         return hop.gendirectcall(ll_char_mul, v_char, v_int)

Modified: pypy/dist/pypy/rpython/test/test_rstr.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rstr.py	(original)
+++ pypy/dist/pypy/rpython/test/test_rstr.py	Wed Jul 20 15:35:54 2005
@@ -397,3 +397,13 @@
 	    else:
 		res = interpret(fn, [i, j])
 		assert res == expected
+
+
+def test_char_mul_n():
+    def f(c, n):
+        return c*n
+    res = interpret(f, ['a', 4])
+    assert ''.join(res.chars) == 'a'*4
+    res = interpret(f, ['a', 0])
+    assert ''.join(res.chars) == ""
+    



More information about the Pypy-commit mailing list