rust/src/test/run-pass/string-self-append.rs

17 lines
337 B
Rust
Raw Normal View History

use std;
import str;
2011-07-27 07:19:39 -05:00
fn main() {
// Make sure we properly handle repeated self-appends.
let mut a: ~str = ~"A";
let mut i = 20;
let mut expected_len = 1u;
2011-07-27 07:19:39 -05:00
while i > 0 {
2012-02-23 03:44:04 -06:00
log(error, str::len(a));
assert (str::len(a) == expected_len);
a += a;
i -= 1;
expected_len *= 2u;
}
}