From c7138b3d06582f1f5a5099fc198fff8bc9e8f73e Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Thu, 15 Jan 2009 01:47:22 -0800 Subject: [PATCH] test for char* slices --- tests/run/slice_charptr.pyx | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/run/slice_charptr.pyx 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[:] + -- 2.26.2