Skip to content

Commit 5ebe61c

Browse files
committed
Consolidate std::str tests into stdtest::str
1 parent d0c509a commit 5ebe61c

File tree

4 files changed

+28
-41
lines changed

4 files changed

+28
-41
lines changed

src/test/stdtest/stdtest.rc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ mod rand;
2424
mod run;
2525
mod sha1;
2626
mod sort;
27-
mod str_buf;
2827
mod str;
2928
mod task;
3029
mod test;
3130
mod uint;
32-
mod vec_str_conversions;
3331

3432
// Local Variables:
3533
// mode: rust

src/test/stdtest/str.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,3 +285,31 @@ fn as_buf_small() {
285285
});
286286
assert b == 100;
287287
}
288+
289+
#[test]
290+
fn as_buf2() {
291+
let s = ~"hello";
292+
let sb = istr::as_buf(s, { |b| b });
293+
let s_cstr = istr::str_from_cstr(sb);
294+
assert (istr::eq(s_cstr, s));
295+
}
296+
297+
#[test]
298+
fn vec_str_conversions() {
299+
let s1: istr = ~"All mimsy were the borogoves";
300+
301+
let v: [u8] = istr::bytes(s1);
302+
let s2: istr = istr::unsafe_from_bytes(v);
303+
let i: uint = 0u;
304+
let n1: uint = istr::byte_len(s1);
305+
let n2: uint = vec::len::<u8>(v);
306+
assert (n1 == n2);
307+
while i < n1 {
308+
let a: u8 = s1[i];
309+
let b: u8 = s2[i];
310+
log a;
311+
log b;
312+
assert (a == b);
313+
i += 1u;
314+
}
315+
}

src/test/stdtest/str_buf.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/test/stdtest/vec_str_conversions.rs

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)