[pypy-svn] r75790 - in pypy/branch/rsre2/pypy/rlib/rsre: . test
arigo at codespeak.net
arigo at codespeak.net
Fri Jul 2 20:02:45 CEST 2010
Author: arigo
Date: Fri Jul 2 20:02:43 2010
New Revision: 75790
Modified:
pypy/branch/rsre2/pypy/rlib/rsre/rsre.py
pypy/branch/rsre2/pypy/rlib/rsre/test/test_match.py
Log:
Oups, by fault for not seeing the test fail. I did not implement
NOT_LITERAL correctly.
Modified: pypy/branch/rsre2/pypy/rlib/rsre/rsre.py
==============================================================================
--- pypy/branch/rsre2/pypy/rlib/rsre/rsre.py (original)
+++ pypy/branch/rsre2/pypy/rlib/rsre/rsre.py Fri Jul 2 20:02:43 2010
@@ -230,7 +230,7 @@
elif op == OPCODE_NOT_LITERAL:
# match if it's not a literal string
# <NOT_LITERAL> <code>
- if ptr >= ctx.end or ctx.lowstr(ptr) == ctx.pat(ppos):
+ if ptr >= ctx.end or ctx.str(ptr) == ctx.pat(ppos):
return False
ppos += 1
ptr += 1
Modified: pypy/branch/rsre2/pypy/rlib/rsre/test/test_match.py
==============================================================================
--- pypy/branch/rsre2/pypy/rlib/rsre/test/test_match.py (original)
+++ pypy/branch/rsre2/pypy/rlib/rsre/test/test_match.py Fri Jul 2 20:02:43 2010
@@ -135,9 +135,19 @@
assert not rsre.match(r, "aaagaaa")
def test_not_literal(self):
- r, _ = get_code(r"[^a-f]")
- assert rsre.match(r, "B")
- assert not rsre.match(r, "b")
- r, _ = get_code(r"[^a-f]+$")
+ r, _ = get_code(r"[^a]")
+ assert rsre.match(r, "A")
+ assert not rsre.match(r, "a")
+ r, _ = get_code(r"[^a]+$")
assert rsre.match(r, "Bx123")
- assert not rsre.match(r, "--f--")
+ assert not rsre.match(r, "--a--")
+
+ def test_not_literal_ignore(self):
+ import py; py.test.skip("in-progress")
+ r, _ = get_code(r"(?i)[^a]")
+ assert rsre.match(r, "G")
+ assert not rsre.match(r, "a")
+ assert not rsre.match(r, "A")
+ r, _ = get_code(r"(?i)[^a]+$")
+ assert rsre.match(r, "Gx123")
+ assert not rsre.match(r, "--A--")
More information about the Pypy-commit
mailing list