diff options
| author | Patrick Walton <[email protected]> | 2011-03-16 18:40:51 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-03-16 18:42:08 -0700 |
| commit | ea7197e2cf921211fb3b82ad45452c2095f5a589 (patch) | |
| tree | 7023e317dcc61a637388a42b746d91079413eed2 /src/test | |
| parent | Teach configure.sh to probe paths, factor a bit. (diff) | |
| download | rust-ea7197e2cf921211fb3b82ad45452c2095f5a589.tar.xz rust-ea7197e2cf921211fb3b82ad45452c2095f5a589.zip | |
rustc: Add str_from_cstr() and str_from_buf() functions to the standard library, as well as a test case
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-pass/lib-str-buf.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/run-pass/lib-str-buf.rs b/src/test/run-pass/lib-str-buf.rs new file mode 100644 index 00000000..7ba19e92 --- /dev/null +++ b/src/test/run-pass/lib-str-buf.rs @@ -0,0 +1,14 @@ +// -*- rust -*- + +use std; +import std._str; + +fn main() { + auto s = "hello"; + auto sb = _str.rustrt.str_buf(s); + auto s_cstr = _str.rustrt.str_from_cstr(sb); + check (_str.eq(s_cstr, s)); + auto s_buf = _str.rustrt.str_from_buf(sb, 5u); + check (_str.eq(s_buf, s)); +} + |