[pypy-svn] pypy default: allow to use "..." at the end of the list
antocuni
commits-noreply at bitbucket.org
Thu Feb 24 18:25:51 CET 2011
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch:
Changeset: r42270:8c5655ae5e43
Date: 2011-02-24 18:00 +0100
http://bitbucket.org/pypy/pypy/changeset/8c5655ae5e43/
Log: allow to use "..." at the end of the list
diff --git a/pypy/module/pypyjit/test_pypy_c/model.py b/pypy/module/pypyjit/test_pypy_c/model.py
--- a/pypy/module/pypyjit/test_pypy_c/model.py
+++ b/pypy/module/pypyjit/test_pypy_c/model.py
@@ -276,7 +276,12 @@
for exp_op in iter_exp_ops:
if exp_op == '...':
# loop until we find an operation which matches
- exp_op = iter_exp_ops.next()
+ try:
+ exp_op = iter_exp_ops.next()
+ except StopIteration:
+ # the ... is the last line in the expected_ops, so we just
+ # return because it matches everything until the end
+ return
op = self.match_until(exp_op, iter_ops)
else:
op = self._next_op(iter_ops)
diff --git a/pypy/module/pypyjit/test_pypy_c/test_model.py b/pypy/module/pypyjit/test_pypy_c/test_model.py
--- a/pypy/module/pypyjit/test_pypy_c/test_model.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_model.py
@@ -184,6 +184,21 @@
# then the second one does not match
assert not self.match(loop, expected)
+ def test_partial_match_at_the_end(self):
+ loop = """
+ [i0]
+ i1 = int_add(i0, 1)
+ i2 = int_sub(i1, 10)
+ i3 = int_floordiv(i2, 100)
+ i4 = int_mul(i1, 1000)
+ jump(i4)
+ """
+ expected = """
+ i1 = int_add(0, 1)
+ ...
+ """
+ assert self.match(loop, expected)
+
class TestRunPyPyC(BaseTestPyPyC):
More information about the Pypy-commit
mailing list