2010-06-23 21:03:09 -07:00
|
|
|
|
2011-06-15 11:19:50 -07:00
|
|
|
|
|
|
|
// -*- rust -*-
|
2010-09-20 17:42:14 -07:00
|
|
|
use std;
|
2011-12-13 16:25:51 -08:00
|
|
|
import str;
|
2010-09-20 17:42:14 -07:00
|
|
|
|
|
|
|
fn test1() {
|
2011-09-02 15:34:58 -07:00
|
|
|
let s: str = "hello";
|
|
|
|
s += "world";
|
2011-12-22 17:53:53 -08:00
|
|
|
log(debug, s);
|
2011-08-19 15:16:48 -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() {
|
2011-06-15 11:19:50 -07:00
|
|
|
// This tests for issue #163
|
2010-09-20 17:42:14 -07:00
|
|
|
|
2011-09-02 15:34:58 -07:00
|
|
|
let ff: str = "abc";
|
|
|
|
let a: str = ff + "ABC" + ff;
|
|
|
|
let b: str = "ABC" + ff + "ABC";
|
2011-12-22 17:53:53 -08:00
|
|
|
log(debug, a);
|
|
|
|
log(debug, b);
|
2011-09-02 15:34:58 -07:00
|
|
|
assert (str::eq(a, "abcABCabc"));
|
|
|
|
assert (str::eq(b, "ABCabcABC"));
|
2010-09-20 17:42:14 -07:00
|
|
|
}
|
|
|
|
|
2011-08-19 15:16:48 -07:00
|
|
|
fn main() { test1(); test2(); }
|