From: Robert Bradshaw Date: Thu, 15 Jan 2009 09:47:22 +0000 (-0800) Subject: test for char* slices X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c7138b3d06582f1f5a5099fc198fff8bc9e8f73e;p=cython.git test for char* slices --- diff --git a/tests/run/slice_charptr.pyx b/tests/run/slice_charptr.pyx new file mode 100644 index 00000000..5f7369c7 --- /dev/null +++ b/tests/run/slice_charptr.pyx @@ -0,0 +1,11 @@ +__doc__ = """ + >>> do_slice("abcdef", 2, 3) + ('c', 'cdef', 'ab', 'abcdef') + >>> do_slice("abcdef", 0, 5) + ('abcde', 'abcdef', '', 'abcdef') +""" + +def do_slice(s, int i, int j): + cdef char* ss = s + return ss[i:j], ss[i:], ss[:i], ss[:] +