Add std::char_slice

This commit is contained in:
Brian Anderson 2011-08-01 18:15:18 -07:00
parent 0c7a95fde5
commit 598e25e091
2 changed files with 13 additions and 0 deletions

View file

@ -154,6 +154,13 @@ fn test_replace() {
assert (str::replace(" test test ", test, "") == " ");
}
#[test]
fn test_char_slice() {
assert (str::eq("ab", str::char_slice("abc", 0u, 2u)));
assert (str::eq("bc", str::char_slice("abc", 1u, 3u)));
assert (str::eq("", str::char_slice("abc", 1u, 1u)));
assert (str::eq("\u65e5", str::char_slice("\u65e5\u672c", 0u, 1u)));
}
// Local Variables:
// mode: rust;