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-09-01 19:27:58 -05:00
|
|
|
import std::str;
|
2010-09-20 19:42:14 -05:00
|
|
|
|
|
|
|
fn test1() {
|
2011-08-31 19:05:50 -05:00
|
|
|
let s: istr = ~"hello";
|
|
|
|
s += ~"world";
|
2011-06-15 13:19:50 -05:00
|
|
|
log s;
|
2011-08-19 17:16:48 -05:00
|
|
|
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-08-31 19:05:50 -05:00
|
|
|
let ff: istr = ~"abc";
|
|
|
|
let a: istr = ff + ~"ABC" + ff;
|
|
|
|
let b: istr = ~"ABC" + ff + ~"ABC";
|
2011-06-15 13:19:50 -05:00
|
|
|
log a;
|
|
|
|
log b;
|
2011-09-01 19:27:58 -05:00
|
|
|
assert (str::eq(a, ~"abcABCabc"));
|
|
|
|
assert (str::eq(b, ~"ABCabcABC"));
|
2010-09-20 19:42:14 -05:00
|
|
|
}
|
|
|
|
|
2011-08-19 17:16:48 -05:00
|
|
|
fn main() { test1(); test2(); }
|