aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2011-03-16 18:40:51 -0700
committerPatrick Walton <[email protected]>2011-03-16 18:42:08 -0700
commitea7197e2cf921211fb3b82ad45452c2095f5a589 (patch)
tree7023e317dcc61a637388a42b746d91079413eed2 /src/test
parentTeach configure.sh to probe paths, factor a bit. (diff)
downloadrust-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.rs14
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));
+}
+