Skip to content

Commit fc9169f

Browse files
killerswanbrson
authored andcommitted
Make the tests work, too
1 parent 8f367eb commit fc9169f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/libcore/str.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,8 @@ Function: index
841841
842842
Returns the index of the first matching byte. Returns -1 if
843843
no match is found.
844+
845+
FIXME: UTF-8
844846
*/
845847
fn index(s: str, c: u8) -> int {
846848
let i: int = 0;
@@ -853,6 +855,8 @@ Function: rindex
853855
854856
Returns the index of the last matching byte. Returns -1
855857
if no match is found.
858+
859+
FIXME: UTF-8
856860
*/
857861
fn rindex(s: str, c: u8) -> int {
858862
let n: int = byte_len(s) as int;
@@ -874,6 +878,8 @@ needle - The string to look for
874878
Returns:
875879
876880
The index of the first occurance of `needle`, or -1 if not found.
881+
882+
FIXME: UTF-8?
877883
*/
878884
fn find(haystack: str, needle: str) -> int {
879885
let haystack_len: int = byte_len(haystack) as int;
@@ -1589,9 +1595,9 @@ mod tests {
15891595

15901596
#[test]
15911597
fn test_unsafe_slice() unsafe {
1592-
assert (eq("ab", slice("abc", 0u, 2u)));
1593-
assert (eq("bc", slice("abc", 1u, 3u)));
1594-
assert (eq("", slice("abc", 1u, 1u)));
1598+
assert (eq("ab", unsafe::slice_bytes("abc", 0u, 2u)));
1599+
assert (eq("bc", unsafe::slice_bytes("abc", 1u, 3u)));
1600+
assert (eq("", unsafe::slice_bytes("abc", 1u, 1u)));
15951601
fn a_million_letter_a() -> str {
15961602
let i = 0;
15971603
let rs = "";

0 commit comments

Comments
 (0)