2010-06-23 23:03:09 -05:00
|
|
|
|
2011-06-15 13:19:50 -05:00
|
|
|
|
|
|
|
// -*- rust -*-
|
2010-09-20 19:42:14 -05:00
|
|
|
use std;
|
2011-05-17 13:41:41 -05:00
|
|
|
import std::str;
|
2010-09-20 19:42:14 -05:00
|
|
|
|
|
|
|
fn test1() {
|
2011-07-27 07:19:39 -05:00
|
|
|
let s: str = "hello";
|
2011-06-15 13:19:50 -05:00
|
|
|
s += "world";
|
|
|
|
log s;
|
|
|
|
assert (s.(9) == 'd' as u8);
|
2010-06-23 23:03:09 -05:00
|
|
|
}
|
2010-09-20 19:42:14 -05:00
|
|
|
|
|
|
|
fn test2() {
|
2011-06-15 13:19:50 -05:00
|
|
|
// This tests for issue #163
|
2010-09-20 19:42:14 -05:00
|
|
|
|
2011-07-27 07:19:39 -05:00
|
|
|
let ff: str = "abc";
|
|
|
|
let a: str = ff + "ABC" + ff;
|
|
|
|
let b: str = "ABC" + ff + "ABC";
|
2011-06-15 13:19:50 -05:00
|
|
|
log a;
|
|
|
|
log b;
|
|
|
|
assert (str::eq(a, "abcABCabc"));
|
|
|
|
assert (str::eq(b, "ABCabcABC"));
|
2010-09-20 19:42:14 -05:00
|
|
|
}
|
|
|
|
|
2011-06-15 13:19:50 -05:00
|
|
|
fn main() { test1(); test2(); }
|