aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass/lib-str.rs
diff options
context:
space:
mode:
authorTim Chevalier <[email protected]>2011-05-02 11:23:07 -0700
committerGraydon Hoare <[email protected]>2011-05-02 12:16:29 -0700
commitaa25f22f197682de3b18fc4c8ba068d1feda220f (patch)
tree6d01f8fbb5680964fd9c53564c96aa58cb75d3d1 /src/test/run-pass/lib-str.rs
parentrustc: Add a "fat tydesc" LLVM type to trans (diff)
downloadrust-aa25f22f197682de3b18fc4c8ba068d1feda220f.tar.xz
rust-aa25f22f197682de3b18fc4c8ba068d1feda220f.zip
Use different syntax for checks that matter to typestate
This giant commit changes the syntax of Rust to use "assert" for "check" expressions that didn't mean anything to the typestate system, and continue using "check" for checks that are used as part of typestate checking. Most of the changes are just replacing "check" with "assert" in test cases and rustc.
Diffstat (limited to 'src/test/run-pass/lib-str.rs')
-rw-r--r--src/test/run-pass/lib-str.rs38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/test/run-pass/lib-str.rs b/src/test/run-pass/lib-str.rs
index 835c08a2..76717711 100644
--- a/src/test/run-pass/lib-str.rs
+++ b/src/test/run-pass/lib-str.rs
@@ -2,22 +2,22 @@ use std;
import std._str;
fn test_bytes_len() {
- check (_str.byte_len("") == 0u);
- check (_str.byte_len("hello world") == 11u);
- check (_str.byte_len("\x63") == 1u);
- check (_str.byte_len("\xa2") == 2u);
- check (_str.byte_len("\u03c0") == 2u);
- check (_str.byte_len("\u2620") == 3u);
- check (_str.byte_len("\U0001d11e") == 4u);
+ assert (_str.byte_len("") == 0u);
+ assert (_str.byte_len("hello world") == 11u);
+ assert (_str.byte_len("\x63") == 1u);
+ assert (_str.byte_len("\xa2") == 2u);
+ assert (_str.byte_len("\u03c0") == 2u);
+ assert (_str.byte_len("\u2620") == 3u);
+ assert (_str.byte_len("\U0001d11e") == 4u);
}
fn test_index_and_rindex() {
- check(_str.index("hello", 'e' as u8) == 1);
- check(_str.index("hello", 'o' as u8) == 4);
- check(_str.index("hello", 'z' as u8) == -1);
- check(_str.rindex("hello", 'l' as u8) == 3);
- check(_str.rindex("hello", 'h' as u8) == 0);
- check(_str.rindex("hello", 'z' as u8) == -1);
+ assert (_str.index("hello", 'e' as u8) == 1);
+ assert (_str.index("hello", 'o' as u8) == 4);
+ assert (_str.index("hello", 'z' as u8) == -1);
+ assert (_str.rindex("hello", 'l' as u8) == 3);
+ assert (_str.rindex("hello", 'h' as u8) == 0);
+ assert (_str.rindex("hello", 'z' as u8) == -1);
}
fn test_split() {
@@ -30,7 +30,7 @@ fn test_split() {
log z;
}
log "comparing: " + v.(i) + " vs. " + k;
- check(_str.eq(v.(i), k));
+ assert (_str.eq(v.(i), k));
}
t("abc.hello.there", '.', 0, "abc");
t("abc.hello.there", '.', 1, "hello");
@@ -46,7 +46,7 @@ fn test_find() {
let int j = _str.find(haystack,needle);
log "searched for " + needle;
log j;
- check (i == j);
+ assert (i == j);
}
t("this is a simple", "is a", 5);
t("this is a simple", "is z", -1);
@@ -57,7 +57,7 @@ fn test_find() {
fn test_substr() {
fn t(&str a, &str b, int start) {
- check(_str.eq(_str.substr(a, start as uint,
+ assert (_str.eq(_str.substr(a, start as uint,
_str.byte_len(b)), b));
}
@@ -68,7 +68,7 @@ fn test_substr() {
fn test_concat() {
fn t(&vec[str] v, &str s) {
- check(_str.eq(_str.concat(v), s));
+ assert (_str.eq(_str.concat(v), s));
}
t(vec("you", "know", "I'm", "no", "good"), "youknowI'mnogood");
@@ -79,7 +79,7 @@ fn test_concat() {
fn test_connect() {
fn t(&vec[str] v, &str sep, &str s) {
- check(_str.eq(_str.connect(v, sep), s));
+ assert (_str.eq(_str.connect(v, sep), s));
}
t(vec("you", "know", "I'm", "no", "good"), " ", "you know I'm no good");
@@ -95,7 +95,7 @@ fn test_to_upper() {
auto input = "abcDEF" + unicode + "xyz:.;";
auto expected = "ABCDEF" + unicode + "XYZ:.;";
auto actual = _str.to_upper(input);
- check (_str.eq(expected, actual));
+ assert (_str.eq(expected, actual));
}