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