Remove more functions from std::str. Issue #855
This commit is contained in:
parent
6b22640a1f
commit
b714150487
5 changed files with 30 additions and 30 deletions
|
|
@ -3,25 +3,25 @@ import rustrt::sbuf;
|
|||
import uint::le;
|
||||
export sbuf;
|
||||
// export rustrt;
|
||||
export eq;
|
||||
export lteq;
|
||||
// export eq;
|
||||
// export lteq;
|
||||
// export hash;
|
||||
// export is_utf8;
|
||||
// export is_ascii;
|
||||
export alloc;
|
||||
export byte_len;
|
||||
// export byte_len;
|
||||
export buf;
|
||||
// export bytes;
|
||||
// export unsafe_from_byte;
|
||||
// export str_from_cstr;
|
||||
// export str_from_buf;
|
||||
// export push_utf8_bytes;
|
||||
export from_char;
|
||||
// export from_char;
|
||||
// export from_chars;
|
||||
// export utf8_char_width;
|
||||
// export char_range_at;
|
||||
export char_at;
|
||||
export char_len;
|
||||
// export char_at;
|
||||
// export char_len;
|
||||
// export to_chars;
|
||||
// export push_char;
|
||||
// export pop_char;
|
||||
|
|
@ -30,10 +30,10 @@ export char_len;
|
|||
// export refcount;
|
||||
// export index;
|
||||
// export rindex;
|
||||
export find;
|
||||
// export find;
|
||||
// export starts_with;
|
||||
// export ends_with;
|
||||
export substr;
|
||||
// export substr;
|
||||
// export slice;
|
||||
// export shift_byte;
|
||||
// export pop_byte;
|
||||
|
|
@ -42,7 +42,7 @@ export substr;
|
|||
// export split;
|
||||
// export concat;
|
||||
// export connect;
|
||||
export to_upper;
|
||||
// export to_upper;
|
||||
// export safe_slice;
|
||||
export unsafe_from_bytes;
|
||||
// export is_empty;
|
||||
|
|
|
|||
|
|
@ -6,15 +6,15 @@
|
|||
|
||||
use std;
|
||||
|
||||
import std::str;
|
||||
import std::istr;
|
||||
import std::comm;
|
||||
import std::task;
|
||||
|
||||
type ctx = comm::chan<int>;
|
||||
|
||||
fn iotask(cx: ctx, ip: str) { assert (str::eq(ip, "localhost")); }
|
||||
fn iotask(cx: ctx, ip: -istr) { assert (istr::eq(ip, ~"localhost")); }
|
||||
|
||||
fn main() {
|
||||
let p = comm::port::<int>();
|
||||
task::spawn(bind iotask(comm::chan(p), "localhost"));
|
||||
task::spawn(bind iotask(comm::chan(p), ~"localhost"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
// -*- rust -*-
|
||||
use std;
|
||||
import std::str;
|
||||
import std::istr;
|
||||
|
||||
fn test1() {
|
||||
let s: str = "hello";
|
||||
s += "world";
|
||||
let s: istr = ~"hello";
|
||||
s += ~"world";
|
||||
log s;
|
||||
assert (s[9] == 'd' as u8);
|
||||
}
|
||||
|
|
@ -14,13 +14,13 @@ fn test1() {
|
|||
fn test2() {
|
||||
// This tests for issue #163
|
||||
|
||||
let ff: str = "abc";
|
||||
let a: str = ff + "ABC" + ff;
|
||||
let b: str = "ABC" + ff + "ABC";
|
||||
let ff: istr = ~"abc";
|
||||
let a: istr = ff + ~"ABC" + ff;
|
||||
let b: istr = ~"ABC" + ff + ~"ABC";
|
||||
log a;
|
||||
log b;
|
||||
assert (str::eq(a, "abcABCabc"));
|
||||
assert (str::eq(b, "ABCabcABC"));
|
||||
assert (istr::eq(a, ~"abcABCabc"));
|
||||
assert (istr::eq(b, ~"ABCabcABC"));
|
||||
}
|
||||
|
||||
fn main() { test1(); test2(); }
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@
|
|||
|
||||
// -*- rust -*-
|
||||
use std;
|
||||
import std::str;
|
||||
import std::istr;
|
||||
|
||||
fn main() {
|
||||
let a: str = "this \
|
||||
let a: istr = ~"this \
|
||||
is a test";
|
||||
let b: str =
|
||||
"this \
|
||||
let b: istr =
|
||||
~"this \
|
||||
is \
|
||||
another \
|
||||
test";
|
||||
assert (str::eq(a, "this is a test"));
|
||||
assert (str::eq(b, "this is another test"));
|
||||
assert (istr::eq(a, ~"this is a test"));
|
||||
assert (istr::eq(b, ~"this is another test"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
use std;
|
||||
import std::str;
|
||||
import std::istr;
|
||||
|
||||
fn main() {
|
||||
// Make sure we properly handle repeated self-appends.
|
||||
let a: str = "A";
|
||||
let a: istr = ~"A";
|
||||
let i = 20;
|
||||
let expected_len = 1u;
|
||||
while i > 0 {
|
||||
log_err str::byte_len(a);
|
||||
assert (str::byte_len(a) == expected_len);
|
||||
log_err istr::byte_len(a);
|
||||
assert (istr::byte_len(a) == expected_len);
|
||||
a += a;
|
||||
i -= 1;
|
||||
expected_len *= 2u;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue