[pypy-svn] r59082 - pypy/trunk/pypy/rpython/test
arigo at codespeak.net
arigo at codespeak.net
Tue Oct 14 11:54:56 CEST 2008
Author: arigo
Date: Tue Oct 14 11:54:55 2008
New Revision: 59082
Modified:
pypy/trunk/pypy/rpython/test/test_rstr.py
Log:
Fix these tests to work even in the presence of
constant-folding in the flow space.
Modified: pypy/trunk/pypy/rpython/test/test_rstr.py
==============================================================================
--- pypy/trunk/pypy/rpython/test/test_rstr.py (original)
+++ pypy/trunk/pypy/rpython/test/test_rstr.py Tue Oct 14 11:54:55 2008
@@ -396,22 +396,25 @@
def test_str_slice(self):
const = self.const
- def fn():
- s = const('hello')
+ def fn(n):
+ s = [const('hello'), const('world')][n] # non-constant
s1 = s[:3]
s2 = s[3:]
s3 = s[3:10]
return s1+s2 == s and s2+s1 == const('lohel') and s1+s3 == s
- res = self.interpret(fn, ())
+ res = self.interpret(fn, [0])
assert res
def test_str_slice_minusone(self):
const = self.const
- def fn():
+ def fn(n):
s = const('hello')
z = const('h')
+ lst = [s, z] # uncontantify s and z
+ s = lst[n]
+ z = lst[n+1]
return s[:-1]+z[:-1]
- res = self.interpret(fn, ())
+ res = self.interpret(fn, [0])
assert self.ll_to_string(res) == const('hell')
def test_strformat(self):
More information about the Pypy-commit
mailing list