Make the tests work, too

This commit is contained in:
Kevin Cantu
2012-02-01 04:30:19 -08:00
committed by Brian Anderson
parent 8f367ebfeb
commit fc9169f09c
+9 -3
View File
@@ -841,6 +841,8 @@ fn lines_iter(ss: str, ff: fn(&&str)) {
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 @@ fn index(s: str, c: u8) -> int {
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 @@ fn rindex(s: str, c: u8) -> int {
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 @@ fn test_to_lower() {
#[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 = "";