[pypy-svn] r30040 - in pypy/dist/pypy/translator/cli: src test
antocuni at codespeak.net
antocuni at codespeak.net
Fri Jul 14 15:48:39 CEST 2006
Author: antocuni
Date: Fri Jul 14 15:48:33 2006
New Revision: 30040
Modified:
pypy/dist/pypy/translator/cli/src/pypylib.cs
pypy/dist/pypy/translator/cli/test/test_string.py
Log:
bugfix and the corresponding test. It failed when calling oostring(n, -1),
with n integer.
Modified: pypy/dist/pypy/translator/cli/src/pypylib.cs
==============================================================================
--- pypy/dist/pypy/translator/cli/src/pypylib.cs (original)
+++ pypy/dist/pypy/translator/cli/src/pypylib.cs Fri Jul 14 15:48:33 2006
@@ -55,6 +55,8 @@
public static string OOString(int n, int base_)
{
+ if (base_ == -1)
+ base_ = 10;
if (n<0 && base_ != 10)
return "-" + Convert.ToString(-n, base_);
else
Modified: pypy/dist/pypy/translator/cli/test/test_string.py
==============================================================================
--- pypy/dist/pypy/translator/cli/test/test_string.py (original)
+++ pypy/dist/pypy/translator/cli/test/test_string.py Fri Jul 14 15:48:33 2006
@@ -44,3 +44,8 @@
s2 = ''.join([y, 'e', 'l', 'l', 'o'])
return (hash(s1) == hash(s2)) and (s1 is not s2)
assert self.interpret(fn, ['h', 'h']) == True
+
+ def test_int_formatting(self):
+ def fn(answer):
+ return 'the answer is %s' % answer
+ assert self.ll_to_string(self.interpret(fn, [42])) == 'the answer is 42'
More information about the Pypy-commit
mailing list