aboutsummaryrefslogtreecommitdiff
path: root/src/lib/_str.rs
diff options
context:
space:
mode:
authorRoy Frostig <[email protected]>2010-08-20 12:57:38 -0700
committerRoy Frostig <[email protected]>2010-08-20 12:57:38 -0700
commit2da4fecacd1b61e9e090e93c33394712fa7f066c (patch)
treea8cfa1e04cd0c39d91441a71d3a4bcba0ef8cba7 /src/lib/_str.rs
parentAllow every test to make a .tmp file that is cleaned up before execution. (diff)
downloadrust-2da4fecacd1b61e9e090e93c33394712fa7f066c.tar.xz
rust-2da4fecacd1b61e9e090e93c33394712fa7f066c.zip
Test the buffered reader and writer in _io.
Diffstat (limited to 'src/lib/_str.rs')
-rw-r--r--src/lib/_str.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/_str.rs b/src/lib/_str.rs
index 807edf31..a29e1daa 100644
--- a/src/lib/_str.rs
+++ b/src/lib/_str.rs
@@ -11,6 +11,22 @@ native "rust" mod rustrt {
fn refcount[T](str s) -> uint;
}
+fn eq(str a, str b) -> bool {
+ let uint i = byte_len(a);
+ if (byte_len(b) != i) {
+ ret false;
+ }
+ while (i > 0u) {
+ i -= 1u;
+ auto cha = a.(i);
+ auto chb = b.(i);
+ if (cha != chb) {
+ ret false;
+ }
+ }
+ ret true;
+}
+
fn is_utf8(vec[u8] v) -> bool {
fail; // FIXME
}