2011-08-22 15:53:39 -05:00
|
|
|
fn test_stack_assign() {
|
|
|
|
let s: istr = ~"a";
|
|
|
|
log s;
|
|
|
|
let t: istr = ~"a";
|
|
|
|
assert s == t;
|
|
|
|
let u: istr = ~"b";
|
|
|
|
assert s != u;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn test_heap_lit() {
|
|
|
|
~"a big string";
|
|
|
|
}
|
|
|
|
|
2011-08-22 16:33:31 -05:00
|
|
|
fn test_heap_assign() {
|
2011-08-22 18:39:18 -05:00
|
|
|
let s: istr = ~"a big ol' string";
|
|
|
|
let t: istr = ~"a big ol' string";
|
|
|
|
assert s == t;
|
|
|
|
let u: istr = ~"a bad ol' string";
|
|
|
|
assert s != u;
|
2011-08-22 16:33:31 -05:00
|
|
|
}
|
|
|
|
|
2011-08-22 18:12:42 -05:00
|
|
|
fn test_heap_log() {
|
|
|
|
let s = ~"a big ol' string";
|
|
|
|
log s;
|
|
|
|
}
|
|
|
|
|
2011-08-22 18:39:18 -05:00
|
|
|
fn test_stack_add() {
|
|
|
|
assert ~"a" + ~"b" == ~"ab";
|
|
|
|
let s: istr = ~"a";
|
|
|
|
assert s + s == ~"aa";
|
|
|
|
assert ~"" + ~"" == ~"";
|
|
|
|
}
|
|
|
|
|
|
|
|
fn test_stack_heap_add() {
|
|
|
|
assert ~"a" + ~"bracadabra" == ~"abracadabra";
|
|
|
|
}
|
|
|
|
|
|
|
|
fn test_heap_add() {
|
|
|
|
assert ~"this should" + ~" totally work" == ~"this should totally work";
|
|
|
|
}
|
|
|
|
|
2011-08-22 15:53:39 -05:00
|
|
|
fn main() {
|
|
|
|
test_stack_assign();
|
|
|
|
test_heap_lit();
|
2011-08-22 16:33:31 -05:00
|
|
|
test_heap_assign();
|
2011-08-22 18:12:42 -05:00
|
|
|
test_heap_log();
|
2011-08-22 18:39:18 -05:00
|
|
|
test_stack_add();
|
|
|
|
test_stack_heap_add();
|
|
|
|
test_heap_add();
|
2011-08-22 15:53:39 -05:00
|
|
|
}
|