From fc9169f09c8999040bc2bdb313dd44fbb70472f8 Mon Sep 17 00:00:00 2001 From: Kevin Cantu Date: Wed, 1 Feb 2012 04:30:19 -0800 Subject: Make the tests work, too --- src/libcore/str.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/libcore') diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 742d31fea3e..c5e037b276d 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -841,6 +841,8 @@ Function: index Returns the index of the first matching byte. Returns -1 if no match is found. + +FIXME: UTF-8 */ fn index(s: str, c: u8) -> int { let i: int = 0; @@ -853,6 +855,8 @@ Function: rindex Returns the index of the last matching byte. Returns -1 if no match is found. + +FIXME: UTF-8 */ fn rindex(s: str, c: u8) -> int { let n: int = byte_len(s) as int; @@ -874,6 +878,8 @@ needle - The string to look for Returns: The index of the first occurance of `needle`, or -1 if not found. + +FIXME: UTF-8? */ fn find(haystack: str, needle: str) -> int { let haystack_len: int = byte_len(haystack) as int; @@ -1589,9 +1595,9 @@ mod tests { #[test] fn test_unsafe_slice() unsafe { - assert (eq("ab", slice("abc", 0u, 2u))); - assert (eq("bc", slice("abc", 1u, 3u))); - assert (eq("", slice("abc", 1u, 1u))); + assert (eq("ab", unsafe::slice_bytes("abc", 0u, 2u))); + assert (eq("bc", unsafe::slice_bytes("abc", 1u, 3u))); + assert (eq("", unsafe::slice_bytes("abc", 1u, 1u))); fn a_million_letter_a() -> str { let i = 0; let rs = ""; -- cgit 1.4.1-3-g733a5