Commits

Armin Rigo committed 300213f

Add a test checking that the "'\x00' in s" done by space.str0()
can be constant-folded if s is a constant.

Comments (0)

Files changed (1)

pypy/jit/metainterp/test/test_ajit.py

         res = self.interp_operations(f, [42])
         assert res == ord(u"?")
 
+    def test_char_in_constant_string(self):
+        def g(string):
+            return '\x00' in string
+        def f():
+            if g('abcdef'): return -60
+            if not g('abc\x00ef'): return -61
+            return 42
+        res = self.interp_operations(f, [])
+        assert res == 42
+        self.check_operations_history({'finish': 1})   # nothing else
+
     def test_residual_call(self):
         @dont_look_inside
         def externfn(x, y):