aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass/lib-str.rs
diff options
context:
space:
mode:
authorMarijn Haverbeke <[email protected]>2011-05-06 22:13:13 +0200
committerMarijn Haverbeke <[email protected]>2011-05-06 22:51:19 +0200
commita3ec0b1f643d00b9418e4884bd7caa07bf052201 (patch)
tree82000510ac9c9cf3f0c7cf4ae5f3c6b123b559cb /src/test/run-pass/lib-str.rs
parentRegister new snapshots. (diff)
downloadrust-a3ec0b1f643d00b9418e4884bd7caa07bf052201.tar.xz
rust-a3ec0b1f643d00b9418e4884bd7caa07bf052201.zip
Rename std modules to be camelcased
(Have fun mergining your stuff with this.)
Diffstat (limited to 'src/test/run-pass/lib-str.rs')
-rw-r--r--src/test/run-pass/lib-str.rs46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/test/run-pass/lib-str.rs b/src/test/run-pass/lib-str.rs
index 76717711..58779f67 100644
--- a/src/test/run-pass/lib-str.rs
+++ b/src/test/run-pass/lib-str.rs
@@ -1,36 +1,36 @@
use std;
-import std._str;
+import std.Str;
fn test_bytes_len() {
- assert (_str.byte_len("") == 0u);
- assert (_str.byte_len("hello world") == 11u);
- assert (_str.byte_len("\x63") == 1u);
- assert (_str.byte_len("\xa2") == 2u);
- assert (_str.byte_len("\u03c0") == 2u);
- assert (_str.byte_len("\u2620") == 3u);
- assert (_str.byte_len("\U0001d11e") == 4u);
+ assert (Str.byte_len("") == 0u);
+ assert (Str.byte_len("hello world") == 11u);
+ assert (Str.byte_len("\x63") == 1u);
+ assert (Str.byte_len("\xa2") == 2u);
+ assert (Str.byte_len("\u03c0") == 2u);
+ assert (Str.byte_len("\u2620") == 3u);
+ assert (Str.byte_len("\U0001d11e") == 4u);
}
fn test_index_and_rindex() {
- assert (_str.index("hello", 'e' as u8) == 1);
- assert (_str.index("hello", 'o' as u8) == 4);
- assert (_str.index("hello", 'z' as u8) == -1);
- assert (_str.rindex("hello", 'l' as u8) == 3);
- assert (_str.rindex("hello", 'h' as u8) == 0);
- assert (_str.rindex("hello", 'z' as u8) == -1);
+ assert (Str.index("hello", 'e' as u8) == 1);
+ assert (Str.index("hello", 'o' as u8) == 4);
+ assert (Str.index("hello", 'z' as u8) == -1);
+ assert (Str.rindex("hello", 'l' as u8) == 3);
+ assert (Str.rindex("hello", 'h' as u8) == 0);
+ assert (Str.rindex("hello", 'z' as u8) == -1);
}
fn test_split() {
fn t(&str s, char c, int i, &str k) {
log "splitting: " + s;
log i;
- auto v = _str.split(s, c as u8);
+ auto v = Str.split(s, c as u8);
log "split to: ";
for (str z in v) {
log z;
}
log "comparing: " + v.(i) + " vs. " + k;
- assert (_str.eq(v.(i), k));
+ assert (Str.eq(v.(i), k));
}
t("abc.hello.there", '.', 0, "abc");
t("abc.hello.there", '.', 1, "hello");
@@ -43,7 +43,7 @@ fn test_split() {
fn test_find() {
fn t(&str haystack, &str needle, int i) {
- let int j = _str.find(haystack,needle);
+ let int j = Str.find(haystack,needle);
log "searched for " + needle;
log j;
assert (i == j);
@@ -57,8 +57,8 @@ fn test_find() {
fn test_substr() {
fn t(&str a, &str b, int start) {
- assert (_str.eq(_str.substr(a, start as uint,
- _str.byte_len(b)), b));
+ assert (Str.eq(Str.substr(a, start as uint,
+ Str.byte_len(b)), b));
}
t("hello", "llo", 2);
@@ -68,7 +68,7 @@ fn test_substr() {
fn test_concat() {
fn t(&vec[str] v, &str s) {
- assert (_str.eq(_str.concat(v), s));
+ assert (Str.eq(Str.concat(v), s));
}
t(vec("you", "know", "I'm", "no", "good"), "youknowI'mnogood");
@@ -79,7 +79,7 @@ fn test_concat() {
fn test_connect() {
fn t(&vec[str] v, &str sep, &str s) {
- assert (_str.eq(_str.connect(v, sep), s));
+ assert (Str.eq(Str.connect(v, sep), s));
}
t(vec("you", "know", "I'm", "no", "good"), " ", "you know I'm no good");
@@ -94,8 +94,8 @@ fn test_to_upper() {
auto unicode = "\u65e5\u672c";
auto input = "abcDEF" + unicode + "xyz:.;";
auto expected = "ABCDEF" + unicode + "XYZ:.;";
- auto actual = _str.to_upper(input);
- assert (_str.eq(expected, actual));
+ auto actual = Str.to_upper(input);
+ assert (Str.eq(expected, actual));
}